optimizations

This commit is contained in:
2026-03-28 19:15:39 +01:00
parent 0b25d9570a
commit cab4fbd83e
509 changed files with 1016804 additions and 1605 deletions

View File

@@ -5,11 +5,13 @@ use App\Models\User;
test('profile page is displayed', function () {
$user = User::factory()->create(['email' => null]);
$response = $this
->actingAs($user)
->get('/profile');
$response = $this
->actingAs($user)
->get('/profile');
$response->assertOk();
$response
->assertStatus(301)
->assertRedirect('/dashboard/profile');
});
test('profile information can be updated', function () {
@@ -17,14 +19,14 @@ test('profile information can be updated', function () {
$response = $this
->actingAs($user)
->patch('/profile', [
->patch('/profile', [
'name' => 'Test User',
'email' => 'test@example.com',
]);
$response
->assertSessionHasNoErrors()
->assertRedirect('/user');
$response
->assertSessionHasNoErrors()
->assertRedirect('/dashboard/profile');
$user->refresh();
@@ -38,14 +40,14 @@ test('email verification status is unchanged when the email address is unchanged
$response = $this
->actingAs($user)
->patch('/profile', [
->patch('/profile', [
'name' => 'Test User',
'email' => $user->email,
]);
$response
->assertSessionHasNoErrors()
->assertRedirect('/user');
$response
->assertSessionHasNoErrors()
->assertRedirect('/dashboard/profile');
$this->assertNotNull($user->refresh()->email_verified_at);
});
@@ -55,13 +57,13 @@ test('user can delete their account', function () {
$response = $this
->actingAs($user)
->delete('/profile', [
->delete('/profile', [
'password' => 'password',
]);
$response
->assertSessionHasNoErrors()
->assertRedirect('/');
$response
->assertSessionHasNoErrors()
->assertRedirect('/');
$this->assertGuest();
// User should be soft-deleted, not permanently removed
@@ -74,13 +76,13 @@ test('correct password must be provided to delete account', function () {
$response = $this
->actingAs($user)
->from('/profile')
->delete('/profile', [
->delete('/profile', [
'password' => 'wrong-password',
]);
$response
->assertSessionHasErrorsIn('userDeletion', 'password')
->assertRedirect('/profile');
$response
->assertSessionHasErrorsIn('userDeletion', 'password')
->assertRedirect('/profile');
$this->assertNotNull($user->fresh());
});