Ok so it seems that you can just manually build the mailable and then run the assertion. Hope this is how its meant to be used
$mailable->build();
expect($mailable->hasReplyTo('[email protected]'))->toBeTrue();
Summer Sale! All accounts are 50% off this week.
I am just testing mailables and I noticed something "strange". My mailable figures out what replyTo it should use, inside the mailable.. Yet the assertions only seem to work on things set on the Mail::alwaysReplyTo('[email protected]')->send(new MyAwesomeMail);
Mail::assertSent(MyAwesomeMail::class, function ($mail) {
return $mail->hasTo('[email protected]');
});
Here is how I set the replyTo currently (inside the MyAwesomeMail mailable)
return $this->when($this->template->reply_to, function ($replyTo) {
$this->replyTo($replyTo);
}, function () {
$this->replyTo('[email protected]');
})...
This does not seem to be mentioned in the docs. Is there something I am missing, or are the missing something. I know that there is a section on testing the mailable directly, but that seems to be only for checking the html/text content.
Please or to participate in this conversation.