Skip to content

Commit

Permalink
fix notification fake for arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 12, 2016
1 parent 79ebb9a commit 394ec05
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Illuminate/Support/Testing/Fakes/NotificationFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ class NotificationFake implements NotificationFactory
*/
public function assertSentTo($notifiable, $notification, $callback = null)
{
if (is_array($notifiable) || $notifiable instanceof Collection) {
foreach ($notifiable as $singleNotifiable) {
$this->assertSentTo($singleNotifiable, $notification, $callback);
}

return;
}

PHPUnit::assertTrue(
$this->sent($notifiable, $notification, $callback)->count() > 0,
"The expected [{$notification}] notification was not sent."
Expand All @@ -42,6 +50,14 @@ public function assertSentTo($notifiable, $notification, $callback = null)
*/
public function assertNotSentTo($notifiable, $notification, $callback = null)
{
if (is_array($notifiable) || $notifiable instanceof Collection) {
foreach ($notifiable as $singleNotifiable) {
$this->assertNotSentTo($singleNotifiable, $notification, $callback);
}

return;
}

PHPUnit::assertTrue(
$this->sent($notifiable, $notification, $callback)->count() === 0,
"The unexpected [{$notification}] notification was sent."
Expand Down

0 comments on commit 394ec05

Please sign in to comment.