Add more tests

This commit is contained in:
Constantin Graf
2026-05-22 16:06:51 +02:00
committed by Constantin Graf
parent a73fe59892
commit d00fe2baff
2 changed files with 39 additions and 0 deletions

View File

@@ -240,6 +240,22 @@ class UserEndpointTest extends ApiEndpointTestAbstract
$response->assertJsonValidationErrors(['name']);
}
public function test_update_fails_if_given_user_is_not_the_authenticated_user(): void
{
// Arrange
$data = $this->createUserWithPermission();
$otherData = $this->createUserWithPermission();
Passport::actingAs($otherData->user);
// Act
$response = $this->putJson(route('api.v1.users.update', $data->user->getKey()), [
'name' => 'Updated Name',
]);
// Assert
$response->assertForbidden();
}
public function test_update_fails_if_name_is_too_long(): void
{
// Arrange