You are here

public function HookEventDispatcherManagerSpy::getRegisteredEvent in Hook Event Dispatcher 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/HookEventDispatcherManagerSpy.php \Drupal\Tests\hook_event_dispatcher\Unit\HookEventDispatcherManagerSpy::getRegisteredEvent()
  2. 3.x tests/src/Unit/HookEventDispatcherManagerSpy.php \Drupal\Tests\hook_event_dispatcher\Unit\HookEventDispatcherManagerSpy::getRegisteredEvent()

Getter.

Parameters

string $eventName: Event name.

Return value

\Drupal\hook_event_dispatcher\Event\EventInterface Registered event by name.

File

tests/src/Unit/HookEventDispatcherManagerSpy.php, line 90

Class

HookEventDispatcherManagerSpy
Class HookEventDispatcherManagerSpy.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit

Code

public function getRegisteredEvent($eventName) {
  if (!isset($this->registeredEvents[$eventName])) {
    throw new InvalidArgumentException("The event '{$eventName}' was not registered");
  }
  return $this->registeredEvents[$eventName];
}