You are here

public function HookEventDispatcherManagerSpy::getRegisteredEvent in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/HookEventDispatcherManagerSpy.php \Drupal\Tests\hook_event_dispatcher\Unit\HookEventDispatcherManagerSpy::getRegisteredEvent()
  2. 8 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.

Throws

\InvalidArgumentException

File

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

Class

HookEventDispatcherManagerSpy
Class HookEventDispatcherManagerSpy.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit

Code

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