public function SpyEventDispatcher::dispatch in Hook Event Dispatcher 8
Mocking an event dispatch, saving the event.
File
- tests/
src/ Unit/ Preprocess/ Helpers/ SpyEventDispatcher.php, line 47
Class
- SpyEventDispatcher
- Class SpyEventDispatcher.
Namespace
Drupal\Tests\hook_event_dispatcher\Unit\Preprocess\HelpersCode
public function dispatch($eventName, Event $event = NULL) {
if (count($this->events) === $this->count) {
throw new BadMethodCallException("SpyEventDispatcher got called more then {$this->count} time(s)");
}
$this->events[$eventName] = $event;
}