I am developing a Laravel application. I am using Laravel Broadcast in my application. What I am trying to do now is that I am trying to test if an event is broadcasted in Laravel.
I am broadcasting an event like this:
broadcast(new NewItemCreated($item));
I want to test if the event is broadcasted. How can I test it? I mean in unit test. I want to do something like
Broadcast::assertSent(NewItemCreated::class)
That event is broadcasted within the observer event that is triggered when an item is created.
I think you can treat broadcasting more or less like events, so you can refer to this section of the documentation.