#Test Filament Email Verification.

1 messages · Page 1 of 1 (latest)

frosty atlas
#

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.

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' => '[email protected]',
            'password' => 'password',
            'passwordConfirmation' => 'password',
        ])

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

    $user = User::where('email', '[email protected]')->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
[email protected]
MAIL_PASSWORD="password"
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
?>```
dapper mauveBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution