The Laravel 13 upgrade pulled Pint 1.27.1 to 1.29.3, which changed the laravel preset's default rules. composer lint and the CI lint job fail without this, so it is required rather than cosmetic. Formatting only, applied by `vendor/bin/pint`. The rules that fired were fully_qualified_strict_types, ordered_imports, single_blank_line_at_eof, unary_operator_spaces, not_operator_with_successor_space, braces_position, single_line_empty_body, single_line_after_imports and no_extra_blank_lines. Kept separate from the upgrade commit to keep that diff reviewable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
76 lines
1.9 KiB
PHP
76 lines
1.9 KiB
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Livewire\Livewire;
|
|
|
|
test('profile page is displayed', function () {
|
|
$this->actingAs($user = User::factory()->create());
|
|
|
|
$this->get(route('profile.edit'))->assertOk();
|
|
});
|
|
|
|
test('profile information can be updated', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user);
|
|
|
|
$response = Livewire::test('pages::settings.profile')
|
|
->set('name', 'Test User')
|
|
->set('email', 'test@example.com')
|
|
->call('updateProfileInformation');
|
|
|
|
$response->assertHasNoErrors();
|
|
|
|
$user->refresh();
|
|
|
|
expect($user->name)->toEqual('Test User');
|
|
expect($user->email)->toEqual('test@example.com');
|
|
expect($user->email_verified_at)->toBeNull();
|
|
});
|
|
|
|
test('email verification status is unchanged when email address is unchanged', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user);
|
|
|
|
$response = Livewire::test('pages::settings.profile')
|
|
->set('name', 'Test User')
|
|
->set('email', $user->email)
|
|
->call('updateProfileInformation');
|
|
|
|
$response->assertHasNoErrors();
|
|
|
|
expect($user->refresh()->email_verified_at)->not->toBeNull();
|
|
});
|
|
|
|
test('user can delete their account', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user);
|
|
|
|
$response = Livewire::test('pages::settings.delete-user-form')
|
|
->set('password', 'password')
|
|
->call('deleteUser');
|
|
|
|
$response
|
|
->assertHasNoErrors()
|
|
->assertRedirect('/');
|
|
|
|
expect($user->fresh())->toBeNull();
|
|
expect(auth()->check())->toBeFalse();
|
|
});
|
|
|
|
test('correct password must be provided to delete account', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user);
|
|
|
|
$response = Livewire::test('pages::settings.delete-user-form')
|
|
->set('password', 'wrong-password')
|
|
->call('deleteUser');
|
|
|
|
$response->assertHasErrors(['password']);
|
|
|
|
expect($user->fresh())->not->toBeNull();
|
|
});
|