Skip to content
Permalink
Browse files

set locale conditionally

  • Loading branch information...
taylorotwell committed Sep 17, 2019
1 parent 355b969 commit dd1e0a604713ddae21e6a893e4f605a6777300e8
Showing with 19 additions and 4 deletions.
  1. +7 −4 src/Illuminate/Mail/PendingMail.php
  2. +12 −0 tests/Integration/Mail/SendingMailWithLocaleTest.php
@@ -175,9 +175,12 @@ public function later($delay, MailableContract $mailable)
*/
protected function fill(MailableContract $mailable)
{
return $mailable->to($this->to)
->cc($this->cc)
->bcc($this->bcc)
->locale($this->locale);
return tap($mailable->to($this->to)
->cc($this->cc)
->bcc($this->bcc), function ($mailable) {
if ($this->locale) {
$mailable->locale($this->locale);
}
});
}
}
@@ -69,6 +69,18 @@ public function testMailIsSentWithSelectedLocale()
);
}
public function testMailIsSentWithLocaleFromMailable()
{
$mailable = new TestMail();
$mailable->locale('ar');
Mail::to('test@mail.com')->send($mailable);
$this->assertStringContainsString('esm',
app('swift.transport')->messages()[0]->getBody()
);
}
public function testMailIsSentWithLocaleUpdatedListenersCalled()
{
Carbon::setTestNow('2018-04-01');

0 comments on commit dd1e0a6

Please sign in to comment.
You can’t perform that action at this time.