Last active
April 22, 2019 11:42
-
-
Save sergsoares/3ce8f2ba53415dc0d8a4b88a6a6043d5 to your computer and use it in GitHub Desktop.
Trait to mimic test method [assertJsonStructure](https://laravel.com/docs/5.8/http-tests#assert-json-structure) with Array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace YOUR_NAME_SPACE; | |
| use Illuminate\Foundation\Testing\TestResponse; | |
| use Illuminate\Http\Response; | |
| trait ArrayAssertTrait | |
| { | |
| public function assertArrayStructure($resultData = null, array $structure = null) | |
| { | |
| return (new TestResponse(new Response))->assertJsonStructure($structure, $resultData); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment