Level 51
You can fake the mail class
Mail::fake();
// send you mail
Mail::assertSent(ComfirmYourEmail::class, function ($mail) {
return true; // replace with what your want to unit test
});
1 like
How would a unit test this Laravel method?
I have a Mailable class called ComfirmYourEmail and this method is untested. How do I test it? Cannot seem to find answer in docs.
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->markdown('mail.confirm-email');
}
}
You can fake the mail class
Mail::fake();
// send you mail
Mail::assertSent(ComfirmYourEmail::class, function ($mail) {
return true; // replace with what your want to unit test
});
Please or to participate in this conversation.