add 1MB photo upload limit

This commit is contained in:
Gregor Vostrak
2026-05-26 13:59:44 +02:00
committed by Constantin Graf
parent e29be581fa
commit cb8047028c
2 changed files with 27 additions and 0 deletions

View File

@@ -354,6 +354,25 @@ class UserEndpointTest extends ApiEndpointTestAbstract
$response->assertJsonValidationErrors(['photo']);
}
public function test_update_fails_if_photo_exceeds_1_megabyte(): void
{
// Arrange
$data = $this->createUserWithPermission();
$photo = file_get_contents(resource_path('testfiles/test.png'));
$this->assertIsString($photo);
$photo .= str_repeat("\0", 1024 * 1024);
Passport::actingAs($data->user);
// Act
$response = $this->putJson(route('api.v1.users.update', $data->user->getKey()), [
'photo' => base64_encode($photo),
]);
// Assert
$response->assertUnprocessable();
$response->assertJsonValidationErrors(['photo']);
}
public function test_update_with_null_photo_deletes_photo_file_and_clears_profile_photo_path(): void
{
// Arrange