Skip to content

Commit f455450

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

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Test/PHPUnit/AbstractCacheConstraintTrait.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ 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+
foreach ($values as $value) {
61+
$message .= $name.': '.$value;
62+
}
63+
}
64+
65+
$message .= sprintf("\nThe response body is:\n\n %s", $other->getBody()->rewind()->getContents());
66+
5767
throw new \RuntimeException($message);
5868
}
5969

0 commit comments

Comments
 (0)