Files
speedBB/tests/Unit/UpdateUserProfileInformationTest.php
tracer 88e4a70f88
Some checks failed
CI/CD Pipeline / test (push) Successful in 3s
CI/CD Pipeline / deploy (push) Failing after 15s
Add comprehensive test coverage and update notes
2026-02-08 19:04:12 +01:00

41 lines
1.1 KiB
PHP

<?php
use App\Actions\Fortify\UpdateUserProfileInformation;
use App\Models\User;
it('updates profile without email verification when email unchanged', function (): void {
$user = User::factory()->create([
'name' => 'Old',
'email' => 'old@example.com',
]);
$action = new UpdateUserProfileInformation();
$action->update($user, [
'name' => 'New Name',
'email' => 'old@example.com',
]);
$user->refresh();
expect($user->name)->toBe('New Name');
expect($user->name_canonical)->toBe('new name');
expect($user->email)->toBe('old@example.com');
});
it('resets verification and sends notification when email changes', function (): void {
$user = User::factory()->create([
'name' => 'Old',
'email' => 'old@example.com',
'email_verified_at' => now(),
]);
$action = new UpdateUserProfileInformation();
$action->update($user, [
'name' => 'New Name',
'email' => 'new@example.com',
]);
$user->refresh();
expect($user->email)->toBe('new@example.com');
expect($user->email_verified_at)->toBeNull();
});