Created
February 10, 2020 08:04
-
-
Save devmsh/2f7ebd8bf033f1712ace73a994fa90cd to your computer and use it in GitHub Desktop.
Write better Laravel tests 2
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 | |
| public function test_users_can_get_their_categories_list() | |
| { | |
| // ... | |
| $response = $this->get('api/categories') | |
| ->assertSuccessful() | |
| ->dump() | |
| ->assertJsonCount(5) | |
| ->assertJsonStructure([ | |
| [ | |
| 'id', | |
| 'name', | |
| 'type', | |
| ], | |
| ]); | |
| foreach ($response->json() as $category) { | |
| $this->assertEquals($user->id,$category['user_id']); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment