Skip to content

Commit a44d197

Browse files
authored
[9.x] Testing MailFake add missing cc (#44319)
* add missing tests * add missing fake for cc
1 parent 2375a0a commit a44d197

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/Illuminate/Support/Testing/Fakes/MailFake.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,17 @@ public function to($users)
312312
return (new PendingMailFake($this))->to($users);
313313
}
314314

315+
/**
316+
* Begin the process of mailing a mailable class instance.
317+
*
318+
* @param mixed $users
319+
* @return \Illuminate\Mail\PendingMail
320+
*/
321+
public function cc($users)
322+
{
323+
return (new PendingMailFake($this))->cc($users);
324+
}
325+
315326
/**
316327
* Begin the process of mailing a mailable class instance.
317328
*

tests/Support/SupportTestingMailFakeTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,33 @@ public function testAssertSentWhenRecipientHasPreferredLocale()
5454
});
5555
}
5656

57+
public function testAssertTo()
58+
{
59+
$this->fake->to('[email protected]')->send($this->mailable);
60+
61+
$this->fake->assertSent(MailableStub::class, function ($mail) {
62+
return $mail->hasTo('[email protected]');
63+
});
64+
}
65+
66+
public function testAssertCc()
67+
{
68+
$this->fake->cc('[email protected]')->send($this->mailable);
69+
70+
$this->fake->assertSent(MailableStub::class, function ($mail) {
71+
return $mail->hasCc('[email protected]');
72+
});
73+
}
74+
75+
public function testAssertBcc()
76+
{
77+
$this->fake->bcc('[email protected]')->send($this->mailable);
78+
79+
$this->fake->assertSent(MailableStub::class, function ($mail) {
80+
return $mail->hasBcc('[email protected]');
81+
});
82+
}
83+
5784
public function testAssertNotSent()
5885
{
5986
$this->fake->assertNotSent(MailableStub::class);

0 commit comments

Comments
 (0)