Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add a test
Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
  • Loading branch information
Orrison committed Jun 6, 2025
commit 2ea64676b06fcd7b50ab53d04b38b63859f12a31
22 changes: 22 additions & 0 deletions tests/Notifications/NotificationChannelManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use Illuminate\Notifications\Notifiable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\SendQueuedNotifications;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
use Mockery as m;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -159,6 +161,26 @@ public function testNotificationCanBeQueued()

$manager->send([new NotificationChannelManagerTestNotifiable], new NotificationChannelManagerTestQueuedNotification);
}

public function testSendQueuedNotificationsCanBeOverrideViaContainer()
{
$container = new Container;
$container->instance('config', ['app.name' => 'Name', 'app.logo' => 'Logo']);
$container->instance(Dispatcher::class, $events = m::mock());
$container->instance(Bus::class, $bus = m::mock());
$bus->shouldReceive('dispatch')->with(m::type(TestSendQueuedNotifications::class));
$container->bind(SendQueuedNotifications::class, TestSendQueuedNotifications::class);
Container::setInstance($container);
$manager = m::mock(ChannelManager::class.'[driver]', [$container]);
$events->shouldReceive('listen')->once();

$manager->send([new NotificationChannelManagerTestNotifiable], new NotificationChannelManagerTestQueuedNotification);
}
}

class TestSendQueuedNotifications implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels;
}

class NotificationChannelManagerTestNotifiable
Expand Down