29 lines
682 B
PHP
29 lines
682 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\Notifications;
|
|
|
|
use App\Services\Notifications\NotificationTriggerService;
|
|
use Illuminate\Support\Facades\Event;
|
|
use Tests\TestCase;
|
|
|
|
class NotificationTriggerServiceTest extends TestCase
|
|
{
|
|
public function test_trigger_dispatches_event(): void
|
|
{
|
|
Event::fake();
|
|
|
|
NotificationTriggerService::trigger('customNotification', ['foo' => 'bar']);
|
|
|
|
Event::assertDispatched('customNotification');
|
|
}
|
|
|
|
public function test_to_user_dispatches_event(): void
|
|
{
|
|
Event::fake();
|
|
|
|
NotificationTriggerService::toUser(5, 'Hello', 'Message');
|
|
|
|
Event::assertDispatched('customNotification');
|
|
}
|
|
}
|