KSA-ORACLE/tests/Feature/Auth/VerificationNotificationTest.php
Nyavokevin f96ec3d299
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
first commit
2025-09-02 10:31:17 +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();
});