EventFake
Implements
Uses
Properties
$eventsToFake array
The event types that should be intercepted instead of dispatched.
$eventsToDispatch array
The event types that should be dispatched instead of intercepted.
$events array
All of the events that have been intercepted keyed by type.
Methods
__construct ( Dispatcher $dispatcher , $eventsToFake ) : void
Create a new event fake instance.
Parameters
- $dispatcher Dispatcher
- $eventsToFake array|string
except ( $eventsToDispatch ) : $this
Specify the events that should be dispatched instead of faked.
Parameters
- $eventsToDispatch array|string
assertListening ( $expectedEvent , $expectedListener ) : void
Assert if an event has a listener attached to it.
Parameters
- $expectedEvent string
- $expectedListener string|array
assertDispatched ( $event , $callback ) : void
Assert if an event was dispatched based on a truth-test callback.
Parameters
- $event string|Closure
- $callback callable|int|null
assertDispatchedTimes ( $event , $times ) : void
Assert if an event was dispatched a number of times.
Parameters
- $event string
- $times int
assertNotDispatched ( $event , $callback ) : void
Determine if an event was dispatched based on a truth-test callback.
Parameters
- $event string|Closure
- $callback callable|null
assertNothingDispatched ( ) : void
Assert that no events were dispatched.
dispatched ( $event , $callback ) : Illuminate\...\Collection
Get all of the events matching a truth-test callback.
Parameters
- $event string
- $callback callable|null
hasDispatched ( $event ) : bool
Determine if the given event has been dispatched.
Parameters
- $event string
listen ( $events , $listener ) : void
Register an event listener with the dispatcher.
Parameters
- $events Closure |string|array
- $listener mixed
hasListeners ( $eventName ) : bool
Determine if a given event has listeners.
Parameters
- $eventName string
push ( $event , $payload ) : void
Register an event and payload to be dispatched later.
Parameters
- $event string
- $payload array
subscribe ( $subscriber ) : void
Register an event subscriber with the dispatcher.
Parameters
- $subscriber object|string
flush ( $event ) : void
Flush a set of pushed events.
Parameters
- $event string
dispatch ( $event , $payload , $halt ) : array|null
Fire an event and call the listeners.
Parameters
- $event string|object
- $payload mixed
- $halt bool
shouldFakeEvent ( $eventName , $payload ) : bool
Determine if an event should be faked or actually dispatched.
Parameters
- $eventName string
- $payload mixed
shouldDispatchEvent ( $eventName , $payload ) : bool
Determine whether an event should be dispatched or not.
Parameters
- $eventName string
- $payload mixed
forget ( $event ) : void
Remove a set of listeners from the dispatcher.
Parameters
- $event string
forgetPushed ( ) : void
Forget all of the queued listeners.
until ( $event , $payload ) : mixed
Dispatch an event and call the listeners.
Parameters
- $event string|object
- $payload mixed
__call ( $method , $parameters ) : mixed
Handle dynamic method calls to the dispatcher.
Parameters
- $method string
- $parameters array