Initialer Laravel Commit für BetiX
This commit is contained in:
29
tests/Feature/Auth/VerificationNotificationTest.php
Normal file
29
tests/Feature/Auth/VerificationNotificationTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use App\Notifications\VerifyEmail;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
test('sends verification notification', function () {
|
||||
$user = User::factory()->unverified()->create();
|
||||
|
||||
Notification::fake();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post(route('verification.send'))
|
||||
->assertRedirect(route('dashboard'));
|
||||
|
||||
Notification::assertSentTo($user, VerifyEmail::class);
|
||||
});
|
||||
|
||||
test('does not send verification notification if email is verified', function () {
|
||||
Notification::fake();
|
||||
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post(route('verification.send'))
|
||||
->assertRedirect(route('dashboard'));
|
||||
|
||||
Notification::assertNothingSent();
|
||||
});
|
||||
Reference in New Issue
Block a user