KSA-ORACLE-ALLACCESSKEYS/tests/Feature/Auth/VerificationNotificationTest.php
Nyavokevin 9e5cc5ab1a
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
add dark theme
2025-09-18 20:34:07 +03:00

35 lines
895 B
PHP

<?php
use App\Models\User;
use Illuminate\Auth\Notifications\VerifyEmail;
use Illuminate\Support\Facades\Notification;
uses(\Illuminate\Foundation\Testing\RefreshDatabase::class);
test('sends verification notification', function () {
Notification::fake();
$user = User::factory()->create([
'email_verified_at' => null,
]);
$this->actingAs($user)
->post(route('verification.send'))
->assertRedirect(route('home'));
Notification::assertSentTo($user, VerifyEmail::class);
});
test('does not send verification notification if email is verified', function () {
Notification::fake();
$user = User::factory()->create([
'email_verified_at' => now(),
]);
$this->actingAs($user)
->post(route('verification.send'))
->assertRedirect(route('dashboard', absolute: false));
Notification::assertNothingSent();
});