Created
February 10, 2020 08:09
-
-
Save devmsh/0e811de05d2e7a79bd3dad9c388e3353 to your computer and use it in GitHub Desktop.
Write better Laravel tests 6
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 | |
| /** | |
| * @depends test_user_have_a_copy_of_the_default_categories | |
| */ | |
| public function test_users_can_get_their_categories_list() | |
| { | |
| factory(Category::class, 5)->create(); | |
| $this->passportAs($user = factory(User::class)->create()) | |
| ->get('api/categories') | |
| ->assertSuccessful() | |
| ->assertJsonCount(5) | |
| ->assertJsonPaths('*.user_id', $user->id) | |
| ->assertJsonStructure([ | |
| [ | |
| 'id', | |
| 'name', | |
| 'type', | |
| ], | |
| ]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment