forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[5.3] Add cc emails in mail notifications (laravel#16152)
* Add cc emails in mail notifications * Apply StyleCI formatting
- Loading branch information
1 parent
e5697d5
commit 266a986
Showing
3 changed files
with
64 additions
and
0 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
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 |
---|---|---|
|
@@ -211,6 +211,37 @@ public function testMessageWithToAddress() | |
$channel->send($notifiable, $notification); | ||
} | ||
|
||
public function testMessageWithToCcEmails() | ||
{ | ||
$notification = new NotificationMailChannelTestNotificationWithCcEmails; | ||
$notifiable = new NotificationMailChannelTestNotifiable; | ||
|
||
$message = $notification->toMail($notifiable); | ||
$data = $message->toArray(); | ||
|
||
$channel = new Illuminate\Notifications\Channels\MailChannel( | ||
$mailer = Mockery::mock(Illuminate\Contracts\Mail\Mailer::class) | ||
); | ||
|
||
$views = ['notifications::email', 'notifications::email-plain']; | ||
|
||
$mailer->shouldReceive('send')->with($views, $data, Mockery::on(function ($closure) { | ||
$mock = Mockery::mock('Illuminate\Mailer\Message'); | ||
|
||
$mock->shouldReceive('subject')->once(); | ||
|
||
$mock->shouldReceive('to')->once()->with('[email protected]'); | ||
|
||
$mock->shouldReceive('cc')->once()->with(['[email protected]', '[email protected]']); | ||
|
||
$closure($mock); | ||
|
||
return true; | ||
})); | ||
|
||
$channel->send($notifiable, $notification); | ||
} | ||
|
||
public function testMessageWithPriority() | ||
{ | ||
$notification = new NotificationMailChannelTestNotificationWithPriority; | ||
|
@@ -318,6 +349,15 @@ public function toMail($notifiable) | |
} | ||
} | ||
|
||
class NotificationMailChannelTestNotificationWithCcEmails extends Notification | ||
{ | ||
public function toMail($notifiable) | ||
{ | ||
return (new MailMessage) | ||
->cc(['[email protected]', '[email protected]']); | ||
} | ||
} | ||
|
||
class NotificationMailChannelTestNotificationWithPriority extends Notification | ||
{ | ||
public function toMail($notifiable) | ||
|