Skip to content

Instantly share code, notes, and snippets.

@devmsh
Last active December 11, 2018 11:41
Show Gist options
  • Select an option

  • Save devmsh/3fbe4d298db2548e1ed7eaa335ac8fd4 to your computer and use it in GitHub Desktop.

Select an option

Save devmsh/3fbe4d298db2548e1ed7eaa335ac8fd4 to your computer and use it in GitHub Desktop.
UserUpdateTest
<?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