-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add another assertion to check we can handle multiple tos returned by routeNotificationForMail * Change the way we build $message->to - use a foreach to add each recipient.
- Loading branch information
Showing
2 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,27 @@ public function routeNotificationForMail($notification) | |
|
||
$this->assertEquals($message->tos[0]->getEmail(), '[email protected]'); | ||
$this->assertEquals($message->tos[0]->getName(), 'John Doe'); | ||
|
||
//Also support multiple recipients | ||
$notifiableWithEmailAndName = new class { | ||
use Notifiable; | ||
|
||
public function routeNotificationForMail($notification) | ||
{ | ||
return [ | ||
'[email protected]' => 'John Doe', | ||
'[email protected]' => 'Jane Doe', | ||
]; | ||
} | ||
}; | ||
|
||
$channel->send($notifiableWithEmailAndName, $notification); | ||
$message = $notification->sendgridMessage; | ||
|
||
$this->assertEquals($message->tos[0]->getEmail(), '[email protected]'); | ||
$this->assertEquals($message->tos[0]->getName(), 'John Doe'); | ||
$this->assertEquals($message->tos[1]->getEmail(), '[email protected]'); | ||
$this->assertEquals($message->tos[1]->getName(), 'Jane Doe'); | ||
} | ||
|
||
private function mockSendgrid($statusCode = 200) | ||
|