trait MocksApplicationServices (View source)
protected array | $firedEvents | All of the fired events. | |
protected array | $firedModelEvents | All of the fired model events. | |
protected array | $dispatchedJobs | All of the dispatched jobs. | |
protected array | $dispatchedNotifications | All of the dispatched notifications. |
$this | expectsEvents(array|string $events) Specify a list of events that should be fired for the given operation. | |
$this | doesntExpectEvents(array|string $events) Specify a list of events that should not be fired for the given operation. | |
$this | withoutEvents() Mock the event dispatcher so all events are silenced and collected. | |
array | getFiredEvents(array $events) Filter the given events against the fired events. | |
$this | expectsJobs(array|string $jobs) Specify a list of jobs that should be dispatched for the given operation. | |
$this | doesntExpectJobs(array|string $jobs) Specify a list of jobs that should not be dispatched for the given operation. | |
$this | withoutJobs() Mock the job dispatcher so all jobs are silenced and collected. | |
array | getDispatchedJobs(array $jobs) Filter the given jobs against the dispatched jobs. | |
array | getDispatched(array $classes, array $dispatched) Filter the given classes against an array of dispatched classes. | |
bool | wasDispatched(string $needle, array $haystack) Check if the given class exists in an array of dispatched classes. | |
$this | withoutNotifications() Mock the notification dispatcher so all notifications are silenced. | |
$this | expectsNotification(mixed $notifiable, string $notification) Specify a notification that is expected to be dispatched. |
Specify a list of events that should be fired for the given operation.
These events will be mocked, so that handlers will not actually be executed.
Specify a list of events that should not be fired for the given operation.
These events will be mocked, so that handlers will not actually be executed.
Mock the event dispatcher so all events are silenced and collected.
Filter the given events against the fired events.
Specify a list of jobs that should be dispatched for the given operation.
These jobs will be mocked, so that handlers will not actually be executed.
Specify a list of jobs that should not be dispatched for the given operation.
These jobs will be mocked, so that handlers will not actually be executed.
Mock the job dispatcher so all jobs are silenced and collected.
Filter the given jobs against the dispatched jobs.
Filter the given classes against an array of dispatched classes.
Check if the given class exists in an array of dispatched classes.
Mock the notification dispatcher so all notifications are silenced.
Specify a notification that is expected to be dispatched.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.html