diff --git a/src/Illuminate/Support/Testing/Fakes/MailFake.php b/src/Illuminate/Support/Testing/Fakes/MailFake.php index c2d963d2e2b3..c95c15a55b5c 100644 --- a/src/Illuminate/Support/Testing/Fakes/MailFake.php +++ b/src/Illuminate/Support/Testing/Fakes/MailFake.php @@ -312,6 +312,17 @@ public function to($users) return (new PendingMailFake($this))->to($users); } + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function cc($users) + { + return (new PendingMailFake($this))->cc($users); + } + /** * Begin the process of mailing a mailable class instance. * diff --git a/tests/Support/SupportTestingMailFakeTest.php b/tests/Support/SupportTestingMailFakeTest.php index afaa49f62f47..e46cef255b4c 100644 --- a/tests/Support/SupportTestingMailFakeTest.php +++ b/tests/Support/SupportTestingMailFakeTest.php @@ -54,6 +54,33 @@ public function testAssertSentWhenRecipientHasPreferredLocale() }); } + public function testAssertTo() + { + $this->fake->to('taylor@laravel.com')->send($this->mailable); + + $this->fake->assertSent(MailableStub::class, function ($mail) { + return $mail->hasTo('taylor@laravel.com'); + }); + } + + public function testAssertCc() + { + $this->fake->cc('taylor@laravel.com')->send($this->mailable); + + $this->fake->assertSent(MailableStub::class, function ($mail) { + return $mail->hasCc('taylor@laravel.com'); + }); + } + + public function testAssertBcc() + { + $this->fake->bcc('taylor@laravel.com')->send($this->mailable); + + $this->fake->assertSent(MailableStub::class, function ($mail) { + return $mail->hasBcc('taylor@laravel.com'); + }); + } + public function testAssertNotSent() { $this->fake->assertNotSent(MailableStub::class);