Level 51
Have you tried firing your event through php artisan tinker? Does this send your email? If so then theres an issue with the test otherwise your event is the problem
I am following up a laracast video on sending mails but my test is not passing...
My test class
use DatabaseMigrations;
/** @test */
public function a_comfirmation_email_is_sent_upon_registration()
{
Mail::fake();
event(new Registered(create('App\User')));
Mail::assertSent(PleaseConfirmYourEmail ::class);
}
Event Service Provider Class
protected $listen = [
'App\Events\ThreadHasNewReply' => [
'App\Listeners\NotifyThreadSubscribers',
],
Registered::class => [
'App\Listeners\SendEmailConfirmationRequest'
]
];
My SendEmailConfirmationRequest Class
public function handle(Registered $event)
{
Mail::to($event->user)->send(new PleaseConfirmYourEmail());
}
and when I run this test it just returns
1) Tests\Feature\RegistrationTest::a_comfirmation_email_is_sent_upon_registration
The expected [App\Mail\PleaseConfirmYourEmail] mailable was not sent.
Failed asserting that false is true.
Have you tried firing your event through php artisan tinker? Does this send your email? If so then theres an issue with the test otherwise your event is the problem
Please or to participate in this conversation.