diff --git a/src/Illuminate/Foundation/Testing/TestResponse.php b/src/Illuminate/Foundation/Testing/TestResponse.php index 9fb6decbf2c1..5df7f8effff9 100644 --- a/src/Illuminate/Foundation/Testing/TestResponse.php +++ b/src/Illuminate/Foundation/Testing/TestResponse.php @@ -201,7 +201,16 @@ public function assertDontSee($value) */ public function assertJson(array $data) { - PHPUnit::assertArraySubset($data, $this->decodeResponseJson()); + $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES; + $expected = json_encode($data, $options); + $actual = json_encode($this->decodeResponseJson(), $options); + + $message = 'Unable to find JSON subset: '.PHP_EOL.PHP_EOL. + "[{$expected}]".PHP_EOL.PHP_EOL. + 'within'.PHP_EOL.PHP_EOL. + "[{$actual}].".PHP_EOL.PHP_EOL; + + PHPUnit::assertArraySubset($data, $this->decodeResponseJson(), $strict = false, $message); return $this; }