Level 88
Well in that case are you trying to mock the mail call, however you should check if the email was send or not. In Laravel you can do that like so:
public function testEmail()
{
Mail::fake();
// Your post call here
Mail::assertSent(CommentPosted::class); // This is a mailable class
// You can also check if the correct email was send
// by checking the data that was send to it
Mail::assertSent(CommentPosted::class, function ($mail) use ($user) {
return $mail->hasTo($user->email) &&
$mail->hasCc('...') &&
$mail->hasBcc('...');
});
}
Documentation: https://laravel.com/docs/5.5/mocking#mail-fake
1 like