MocksApplicationServices
trait MocksApplicationServices
Properties
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. |
Methods
Specify a list of events that should be fired for the given operation.
Specify a list of events that should not be fired for the given operation.
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.
Specify a list of jobs that should not be dispatched for the given operation.
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.
Details
at line 50
$this
expectsEvents(array|string $events)
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.
at line 76
$this
doesntExpectEvents(array|string $events)
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.
at line 97
protected $this
withoutEvents()
Mock the event dispatcher so all events are silenced and collected.
at line 116
protected array
getFiredEvents(array $events)
Filter the given events against the fired events.
at line 129
protected $this
expectsJobs(array|string $jobs)
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.
at line 155
protected $this
doesntExpectJobs(array|string $jobs)
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.
at line 176
protected $this
withoutJobs()
Mock the job dispatcher so all jobs are silenced and collected.
at line 197
protected array
getDispatchedJobs(array $jobs)
Filter the given jobs against the dispatched jobs.
at line 209
protected array
getDispatched(array $classes, array $dispatched)
Filter the given classes against an array of dispatched classes.
at line 223
protected bool
wasDispatched(string $needle, array $haystack)
Check if the given class exists in an array of dispatched classes.
at line 240
protected $this
withoutNotifications()
Mock the notification dispatcher so all notifications are silenced.
at line 262
protected $this
expectsNotification(mixed $notifiable, string $notification)
Specify a notification that is expected to be dispatched.