MocksApplicationServices
Table of Contents
- $dispatchedJobs : array<string|int, mixed>
- All of the dispatched jobs.
- $dispatchedNotifications : array<string|int, mixed>
- All of the dispatched notifications.
- $firedEvents : array<string|int, mixed>
- All of the fired events.
- $firedModelEvents : array<string|int, mixed>
- All of the fired model events.
- doesntExpectEvents() : $this
- Specify a list of events that should not be fired for the given operation.
- expectsEvents() : $this
- Specify a list of events that should be fired for the given operation.
- doesntExpectJobs() : $this
- Specify a list of jobs that should not be dispatched for the given operation.
- expectsJobs() : $this
- Specify a list of jobs that should be dispatched for the given operation.
- expectsNotification() : $this
- Specify a notification that is expected to be dispatched.
- getDispatched() : array<string|int, mixed>
- Filter the given classes against an array of dispatched classes.
- getDispatchedJobs() : array<string|int, mixed>
- Filter the given jobs against the dispatched jobs.
- getFiredEvents() : array<string|int, mixed>
- Filter the given events against the fired events.
- wasDispatched() : bool
- Check if the given class exists in an array of dispatched classes.
- withoutEvents() : $this
- Mock the event dispatcher so all events are silenced and collected.
- withoutJobs() : $this
- Mock the job dispatcher so all jobs are silenced and collected.
- withoutNotifications() : $this
- Mock the notification dispatcher so all notifications are silenced.
Properties
$dispatchedJobs
All of the dispatched jobs.
protected
array<string|int, mixed>
$dispatchedJobs
= []
$dispatchedNotifications
All of the dispatched notifications.
protected
array<string|int, mixed>
$dispatchedNotifications
= []
$firedEvents
All of the fired events.
protected
array<string|int, mixed>
$firedEvents
= []
$firedModelEvents
All of the fired model events.
protected
array<string|int, mixed>
$firedModelEvents
= []
Methods
doesntExpectEvents()
Specify a list of events that should not be fired for the given operation.
public
doesntExpectEvents(array<string|int, mixed>|string $events) : $this
These events will be mocked, so that handlers will not actually be executed.
Parameters
- $events : array<string|int, mixed>|string
Return values
$this —expectsEvents()
Specify a list of events that should be fired for the given operation.
public
expectsEvents(array<string|int, mixed>|string $events) : $this
These events will be mocked, so that handlers will not actually be executed.
Parameters
- $events : array<string|int, mixed>|string
Tags
Return values
$this —doesntExpectJobs()
Specify a list of jobs that should not be dispatched for the given operation.
protected
doesntExpectJobs(array<string|int, mixed>|string $jobs) : $this
These jobs will be mocked, so that handlers will not actually be executed.
Parameters
- $jobs : array<string|int, mixed>|string
Return values
$this —expectsJobs()
Specify a list of jobs that should be dispatched for the given operation.
protected
expectsJobs(array<string|int, mixed>|string $jobs) : $this
These jobs will be mocked, so that handlers will not actually be executed.
Parameters
- $jobs : array<string|int, mixed>|string
Return values
$this —expectsNotification()
Specify a notification that is expected to be dispatched.
protected
expectsNotification(mixed $notifiable, string $notification) : $this
Parameters
- $notifiable : mixed
- $notification : string
Return values
$this —getDispatched()
Filter the given classes against an array of dispatched classes.
protected
getDispatched(array<string|int, mixed> $classes, array<string|int, mixed> $dispatched) : array<string|int, mixed>
Parameters
- $classes : array<string|int, mixed>
- $dispatched : array<string|int, mixed>
Return values
array<string|int, mixed> —getDispatchedJobs()
Filter the given jobs against the dispatched jobs.
protected
getDispatchedJobs(array<string|int, mixed> $jobs) : array<string|int, mixed>
Parameters
- $jobs : array<string|int, mixed>
Return values
array<string|int, mixed> —getFiredEvents()
Filter the given events against the fired events.
protected
getFiredEvents(array<string|int, mixed> $events) : array<string|int, mixed>
Parameters
- $events : array<string|int, mixed>
Return values
array<string|int, mixed> —wasDispatched()
Check if the given class exists in an array of dispatched classes.
protected
wasDispatched(string $needle, array<string|int, mixed> $haystack) : bool
Parameters
- $needle : string
- $haystack : array<string|int, mixed>
Return values
bool —withoutEvents()
Mock the event dispatcher so all events are silenced and collected.
protected
withoutEvents() : $this
Return values
$this —withoutJobs()
Mock the job dispatcher so all jobs are silenced and collected.
protected
withoutJobs() : $this
Return values
$this —withoutNotifications()
Mock the notification dispatcher so all notifications are silenced.
protected
withoutNotifications() : $this