Last active
December 11, 2018 11:41
-
-
Save devmsh/3fbe4d298db2548e1ed7eaa335ac8fd4 to your computer and use it in GitHub Desktop.
UserUpdateTest
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 | |
| class UserUpdateTest extends TestCase | |
| { | |
| use DatabaseMigrations; | |
| public function test_user_can_update_profile() | |
| { | |
| Notification::fake(); | |
| Passport::actingAs($user = factory(User::class)->create()); | |
| $response = $this->putJson("api/user/{$user->id}",[ | |
| "name" => "Edited name" | |
| ]); | |
| $response->assertSuccessful(); | |
| $response->assertJsonStructure([ | |
| "data" => [ | |
| "id", | |
| "name", | |
| "notification_settings", | |
| "events_count", | |
| ] | |
| ]); | |
| $this->assertEquals("Edited name",$user->fresh()->name); | |
| Notification::assertSentTo($user,UserUpdateNotification::class); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment