From a0bee24295cb4af7a5c558f5d96e290c21146006 Mon Sep 17 00:00:00 2001 From: Anton Pavlov Date: Tue, 9 May 2017 18:12:14 +0300 Subject: [PATCH] Fix: trait method seeMessageFrom should work when from set with name --- src/Testing/InteractsWithMail.php | 4 +++- tests/InteractsWithMailTest.php | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Testing/InteractsWithMail.php b/src/Testing/InteractsWithMail.php index 8064e5d..b98dbbc 100644 --- a/src/Testing/InteractsWithMail.php +++ b/src/Testing/InteractsWithMail.php @@ -94,7 +94,9 @@ public function seeMessageFrom($email) { $this->seeMessage(); - $from = $this->lastMessage()->from->first(); + $from = $this->lastMessage()->from->map(function ($value, $key) { + return is_numeric($key) ? $value : $key; + })->first(); $this->assertEquals( $email, diff --git a/tests/InteractsWithMailTest.php b/tests/InteractsWithMailTest.php index ee43fd5..ae957e5 100644 --- a/tests/InteractsWithMailTest.php +++ b/tests/InteractsWithMailTest.php @@ -148,6 +148,13 @@ public function test_see_message_from() }); $this->seeMessageFrom('me@example.com'); + + $mailer->send('example-view', [], function ($m) { + $m->from('me2@example.com', 'Name'); + $m->to('john@example.com'); + }); + + $this->seeMessageFrom('me2@example.com'); } public function test_see_headers_for()