While I was working on a project using Laravel, I noticed that assertExactJson()
do sorting on ordered array that I set on api response. Then I stumbled upon a PR from @mnabialek that also mention the same problem (see: laravel/framework#33672). This means you might need to check again your code that use assertExactJson.
The PR itself has been merged, but it merged to the next version of Laravel (v8.x, at the time this writing) and also since Laravel team need to keep their backward compatibility, this fix will not landed on the older version of Laravel (<v8.x). So, I made this gist to fix assertExactJson() in your Laravel v7.x (or older). All you need to do is add createTestResponse()
on your existing test\TestCase.php
and TestResponse.php
on tests
folder.