Skip to content

Instantly share code, notes, and snippets.

@assertchris
Created February 13, 2023 10:56
Show Gist options
  • Save assertchris/678de492abcdff15efcecf13be04c14b to your computer and use it in GitHub Desktop.
Save assertchris/678de492abcdff15efcecf13be04c14b to your computer and use it in GitHub Desktop.
<?php
namespace Tests\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Notification;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;
class ProfileTest extends DuskTestCase
{
use DatabaseMigrations;
public function test_it_sends_verification_emails(): void
{
$this->seed();
$user = $this->me();
$user->email_verified_at = null;
$user->save();
Notification::fake();
Mail::fake();
$this
->browse(function (Browser $browser) use ($user) {
$browser
->loginAs($user)
->visitRoute('show-home')
->waitFor('@resend-verification-email-link')
->click('@resend-verification-email-link');
});
Mail::assertSent(/*..?*/);
Notification::assertSentTo(/*..?*/);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment