feat: mail error sent
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user