MocksApplicationServices deprecated
trait MocksApplicationServices (View source)
deprecated
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
$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.
$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.
protected $this
withoutEvents()
Mock the event dispatcher so all events are silenced and collected.
protected array
getFiredEvents(array $events)
Filter the given events against the fired events.
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.
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.
protected $this
withoutJobs()
Mock the job dispatcher so all jobs are silenced and collected.
protected array
getDispatchedJobs(array $jobs)
Filter the given jobs against the dispatched jobs.
protected array
getDispatched(array $classes, array $dispatched)
Filter the given classes against an array of dispatched classes.
protected bool
wasDispatched(string $needle, array $haystack)
Check if the given class exists in an array of dispatched classes.
protected $this
withoutNotifications()
Mock the notification dispatcher so all notifications are silenced.
protected $this
expectsNotification(mixed $notifiable, string $notification)
Specify a notification that is expected to be dispatched.