Changeset View
Changeset View
Standalone View
Standalone View
src/tests/MailInterceptTrait.php
Show All 20 Lines | trait MailInterceptTrait | ||||
* - 'message': Swift_Message object | * - 'message': Swift_Message object | ||||
*/ | */ | ||||
protected function fakeMail(Mailable $mail): array | protected function fakeMail(Mailable $mail): array | ||||
{ | { | ||||
$this->interceptMail(); | $this->interceptMail(); | ||||
Mail::send($mail); | Mail::send($mail); | ||||
$message = $this->interceptedMail()->first(); | $message = $this->interceptedMail()->last(); | ||||
// SwiftMailer does not have methods to get the bodies, we'll parse the message | // SwiftMailer does not have methods to get the bodies, we'll parse the message | ||||
list($plain, $html) = $this->extractMailBody($message->toString()); | list($plain, $html) = $this->extractMailBody($message->toString()); | ||||
return [ | return [ | ||||
'plain' => $plain, | 'plain' => $plain, | ||||
'html' => $html, | 'html' => $html, | ||||
'message' => $message, | 'message' => $message, | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |