© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
2 replies
Sourabh

Test Filament Email Verification.

I want to test filament email verification by Pest, and I have created a separate MySQL testing database along with the .env.testing environment. When I run the test case, the email verification notification is not received on user email id.
Please find below code for your reference.
<?php 
test('sends the filament email verification notification after registering', function () {
    Notification::fake();
    $response = Livewire(Register::class)
        ->fillForm([
            'name' => 'App User',
            'company_name' => 'Company Name',
            'email' => 'appuser@yopmail.com',
            'password' => 'password',
            'passwordConfirmation' => 'password',
        ])

        ->call('register')
        ->assertHasNoFormErrors();

    $user = User::where('email', 'appuser@yopmail.com')->firstOrFail();

    Notification::assertSentTo([$user], VerifyEmail::class);
});

?>
<?php 
test('sends the filament email verification notification after registering', function () {
    Notification::fake();
    $response = Livewire(Register::class)
        ->fillForm([
            'name' => 'App User',
            'company_name' => 'Company Name',
            'email' => 'appuser@yopmail.com',
            'password' => 'password',
            'passwordConfirmation' => 'password',
        ])

        ->call('register')
        ->assertHasNoFormErrors();

    $user = User::where('email', 'appuser@yopmail.com')->firstOrFail();

    Notification::assertSentTo([$user], VerifyEmail::class);
});

?>

//.env.testing
<?php 
APP_NAME="laravel"
APP_ENV=testing
APP_KEY=base64:UzY9zi19NQxvCu0j8aqCpsg2VK6jDrhynKGGEzPoHzY=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000/


DB_CONNECTION=testing
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=riview_app_testing
DB_USERNAME=root
DB_PASSWORD=tops12345

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120

MAIL_MAILER=smtp
MAIL_HOST=smtp-relay.brevo.com
MAIL_PORT=465
MAIL_USERNAME=sourabh@gmail.com
MAIL_PASSWORD="password"
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="sourabh@gmail.com"
MAIL_FROM_NAME="${APP_NAME}"
?>
<?php 
APP_NAME="laravel"
APP_ENV=testing
APP_KEY=base64:UzY9zi19NQxvCu0j8aqCpsg2VK6jDrhynKGGEzPoHzY=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000/


DB_CONNECTION=testing
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=riview_app_testing
DB_USERNAME=root
DB_PASSWORD=tops12345

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120

MAIL_MAILER=smtp
MAIL_HOST=smtp-relay.brevo.com
MAIL_PORT=465
MAIL_USERNAME=sourabh@gmail.com
MAIL_PASSWORD="password"
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="sourabh@gmail.com"
MAIL_FROM_NAME="${APP_NAME}"
?>
RegisterTest.php2.08KB
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Email Verification
FilamentFFilament / ❓┊help
3y ago
email verification
FilamentFFilament / ❓┊help
3y ago
Email Verification?
FilamentFFilament / ❓┊help
3y ago
Create User in Filament and sent verification email
FilamentFFilament / ❓┊help
3y ago