Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Testing MailFake add missing cc #44319

Merged
merged 2 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Illuminate/Support/Testing/Fakes/MailFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
27 changes: 27 additions & 0 deletions tests/Support/SupportTestingMailFakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ public function testAssertSentWhenRecipientHasPreferredLocale()
});
}

public function testAssertTo()
{
$this->fake->to('[email protected]')->send($this->mailable);

$this->fake->assertSent(MailableStub::class, function ($mail) {
return $mail->hasTo('[email protected]');
});
}

public function testAssertCc()
{
$this->fake->cc('[email protected]')->send($this->mailable);

$this->fake->assertSent(MailableStub::class, function ($mail) {
return $mail->hasCc('[email protected]');
});
}

public function testAssertBcc()
{
$this->fake->bcc('[email protected]')->send($this->mailable);

$this->fake->assertSent(MailableStub::class, function ($mail) {
return $mail->hasBcc('[email protected]');
});
}

public function testAssertNotSent()
{
$this->fake->assertNotSent(MailableStub::class);
Expand Down