I'm proposing adding a couple of additional methods onto the mail fake to make it easier to check the finally rendered contents match your expectations. We have to send a lot of mails and on occasion we've had issues where the right values have been passed to mailables, but the template used them incorrectly leading to a lot of confusion.
At the moment we're manually checking them and/or using some of the work-arounds given in the discussion linked above. It would be a lot cleaner if we could do something along the lines of :
Mail::fake();
...
Mail::assertSent(SomeEmail::class, function ($mail) use ($normalPerson, $importantPerson, $interview) {
return $mail->hasText("Dear {$normalPerson}") &&
$mail->hasText("interview with {$importantPerson}") &&
$mail->hasText("on " . $interview->start->format('d/m/Y');
});
There have been previous discussions about this - for instance https://github.com/laravel/ideas/issues/405 .
I'm proposing adding a couple of additional methods onto the mail fake to make it easier to check the finally rendered contents match your expectations. We have to send a lot of mails and on occasion we've had issues where the right values have been passed to mailables, but the template used them incorrectly leading to a lot of confusion.
At the moment we're manually checking them and/or using some of the work-arounds given in the discussion linked above. It would be a lot cleaner if we could do something along the lines of :