Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
lehecht committed Jun 18, 2024
1 parent 4be4cc3 commit da57655
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions tests/php/Http/Controllers/Api/NotificationControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,11 @@ public function testUpdateAll()
$user->notify(new InAppNotification('test', 'test'));
$user->notify(new InAppNotification('test', 'test'));

$this->doTestApiRoute('PUT', '/api/v1/notifications', ['user_id' => $user->id]);
$this->assertEquals(3, $user->unreadNotifications()->count());
$this->doTestApiRoute('PUT', '/api/v1/notifications/all');

$this->be(UserTest::create());
$this->put('/api/v1/notifications/', ['user_id' => $user->id])
->assertForbidden();

$this->be($user);
$this->put('/api/v1/notifications/', ['user_id' => $user->id])
->assertStatus(200);
$this->assertEquals(3, $user->unreadNotifications()->count());
$this->put('/api/v1/notifications/all')->assertSuccessful();
$this->assertEquals(0, $user->unreadNotifications()->count());

// invalid data
$this->put('/api/v1/notifications/', ['test'])->assertInvalid();
$this->put('/api/v1/notifications/', ['user_id' => 'test'])->assertInvalid();
}
}

0 comments on commit da57655

Please sign in to comment.