trait MocksApplicationServices

Properties

protected array $firedEvents

All of the fired events.

Methods

$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.

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.

Details

at line 32
$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.

Parameters

array|string $events

Return Value

$this

Exceptions

Exception

at line 58
$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.

Parameters

array|string $events

Return Value

$this

at line 79
protected $this withoutEvents()

Mock the event dispatcher so all events are silenced and collected.

Return Value

$this

at line 103
protected array getFiredEvents(array $events)

Filter the given events against the fired events.

Parameters

array $events

Return Value

array

at line 113
protected array getDispatched(array $classes, array $dispatched)

Filter the given classes against an array of dispatched classes.

Parameters

array $classes
array $dispatched

Return Value

array

at line 126
protected bool wasDispatched(string $needle, array $haystack)

Check if the given class exists in an array of dispatched classes.

Parameters

string $needle
array $haystack

Return Value

bool