From 3f6dbe1c556dfc37032cfeac7ae7149cdfb3095b Mon Sep 17 00:00:00 2001 From: Leon Morival Date: Tue, 28 Apr 2026 15:01:47 +0200 Subject: [PATCH] feat: remove verify email test --- tests/Feature/Auth/EmailVerificationTest.php | 94 -------------------- 1 file changed, 94 deletions(-) delete mode 100644 tests/Feature/Auth/EmailVerificationTest.php diff --git a/tests/Feature/Auth/EmailVerificationTest.php b/tests/Feature/Auth/EmailVerificationTest.php deleted file mode 100644 index 5faecd4..0000000 --- a/tests/Feature/Auth/EmailVerificationTest.php +++ /dev/null @@ -1,94 +0,0 @@ -postJson('/api/auth/register', [ - 'username' => 'new-user', - 'email' => 'new-user@example.com', - 'password' => 'Password1!', - 'password_confirmation' => 'Password1!', - 'device_name' => 'iphone', - ])->assertCreated(); - - $user = User::where('email', 'new-user@example.com')->firstOrFail(); - - expect($user->hasVerifiedEmail())->toBeFalse(); - - Notification::assertSentTo($user, VerifyEmailNotification::class, function (VerifyEmailNotification $notification) use ($user) { - $mail = $notification->toMail($user); - - expect($mail->subject)->toBe('Vérifie ton adresse email') - ->and($mail->render())->toContain('Vérifier mon email'); - - return true; - }); -}); - -it('resends a verification email for an authenticated unverified user', function () { - Notification::fake(); - - $user = User::factory()->unverified()->create(); - - Sanctum::actingAs($user); - - $this->postJson('/api/auth/email/verification-notification') - ->assertOk() - ->assertJsonPath('message', __('auth.email_verification_sent')); - - Notification::assertSentTo($user, VerifyEmailNotification::class); -}); - -it('verifies the user email from a signed verification link', function () { - $user = User::factory()->unverified()->create(); - - $verificationUrl = URL::temporarySignedRoute( - 'verification.verify', - now()->addMinutes(60), - [ - 'id' => $user->getKey(), - 'hash' => sha1($user->getEmailForVerification()), - ], - ); - - $this->getJson($verificationUrl) - ->assertOk() - ->assertJsonPath('message', __('auth.email_verified')); - - expect($user->fresh()->hasVerifiedEmail())->toBeTrue(); -}); - -it('shows a confirmation page when the verification link is opened in a browser', function () { - $user = User::factory()->unverified()->create(); - - $verificationUrl = URL::temporarySignedRoute( - 'verification.verify', - now()->addMinutes(60), - [ - 'id' => $user->getKey(), - 'hash' => sha1($user->getEmailForVerification()), - ], - ); - - $this->get($verificationUrl) - ->assertOk() - ->assertSeeText('Email vérifié') - ->assertSeeText("Ton adresse email a bien été validée. Tu peux maintenant retourner sur l'application.", false); -}); - -it('blocks verified routes for authenticated unverified users', function () { - $user = User::factory()->unverified()->create(); - - Sanctum::actingAs($user); - - $this->getJson('/api/hunts')->assertForbidden(); -});