public function SpyEventDispatcher::dispatch in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x modules/preprocess_event_dispatcher/tests/src/Unit/Helpers/SpyEventDispatcher.php \Drupal\Tests\preprocess_event_dispatcher\Unit\Helpers\SpyEventDispatcher::dispatch()
Mocking an event dispatch, saving the event.
File
- modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ Helpers/ SpyEventDispatcher.php, line 47
Class
- SpyEventDispatcher
- Class SpyEventDispatcher.
Namespace
Drupal\Tests\preprocess_event_dispatcher\Unit\HelpersCode
public function dispatch($eventName, Event $event = NULL) : void {
if (count($this->events) === $this->count) {
throw new BadMethodCallException("SpyEventDispatcher got called more then {$this->count} time(s)");
}
$this->events[$eventName] = $event;
}