Skip to content

Commit f79faf2

Browse files
committed
Output more debugging info if cache constraint fails to assert
1 parent f44d4ee commit f79faf2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Test/PHPUnit/AbstractCacheConstraintTrait.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ public function matches($other)
5454
$message .= sprintf("\nStatus code of response is %s.", $other->getStatusCode());
5555
}
5656

57+
$message .= "\nThe response headers are:\n\n";
58+
59+
foreach ($other->getHeaders() as $name => $values) {
60+
$message .= $name . ': ' . implode(', ', $values);
61+
}
62+
63+
$message .= sprintf("\nThe response body is:\n\n %s", $other->getBody()->rewind()->getContents());
64+
5765
throw new \RuntimeException($message);
5866
}
5967

0 commit comments

Comments
 (0)