feat: mail error sent

This commit is contained in:
2026-05-22 13:54:16 +02:00
parent 8ebfd6badf
commit 9fe51e8064
4 changed files with 37 additions and 1 deletions
+19
View File
@@ -56,6 +56,25 @@ it('sends a verification email when a user registers', function () {
Notification::assertSentTo($user, VerifyEmail::class);
});
it('returns a temporary error when the verification email cannot be sent during registration', function () {
Notification::shouldReceive('send')
->once()
->andThrow(new RuntimeException('Mail transport unavailable'));
$this->postJson('/api/auth/register', [
'name' => 'Leon',
'email' => 'leon@example.com',
'password' => 'Motsdfdepasse123*',
'locale' => 'fr-FR',
])
->assertServiceUnavailable()
->assertJsonPath('message', __('api.auth.verification_email_failed'));
$this->assertDatabaseMissing('users', [
'email' => 'leon@example.com',
]);
});
it('uses the custom account verification mailable', function () {
$user = User::factory()->unverified()->create([
'locale' => 'fr',