-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] Allow for closure reflection on all MailFake assertions (#38328)
* [8.x] Allow for closure reflection on all MailFake assertions * Minor refactor * Update src/Illuminate/Support/Testing/Fakes/MailFake.php Co-authored-by: Dries Vints <[email protected]>
- Loading branch information
1 parent
bc1188d
commit ebe072a
Showing
2 changed files
with
46 additions
and
10 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 |
---|---|---|
|
@@ -69,6 +69,22 @@ public function testAssertNotSent() | |
} | ||
} | ||
|
||
public function testAssertNotSentWithClosure() | ||
{ | ||
$callback = function (MailableStub $mail) { | ||
return $mail->hasTo('[email protected]'); | ||
}; | ||
|
||
$this->fake->assertNotSent($callback); | ||
|
||
$this->fake->to('[email protected]')->send($this->mailable); | ||
|
||
$this->expectException(ExpectationFailedException::class); | ||
$this->expectExceptionMessageMatches('/The unexpected \['.preg_quote(MailableStub::class, '/').'\] mailable was sent./m'); | ||
|
||
$this->fake->assertNotSent($callback); | ||
} | ||
|
||
public function testAssertSentTimes() | ||
{ | ||
$this->fake->to('[email protected]')->send($this->mailable); | ||
|