You are here

public function ThemeSuggestionsAlterEventTest::testThemeSuggestionsAlterEvent in Hook Event Dispatcher 8

Tests the themeSuggestionsAlterEvent.

File

tests/src/Unit/Theme/ThemeSuggestionsAlterEventTest.php, line 41

Class

ThemeSuggestionsAlterEventTest
Class ThemeSuggestionsAlterEventTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Theme

Code

public function testThemeSuggestionsAlterEvent() {
  $this->manager
    ->setMaxEventCount(2);
  $suggestions = [
    'container_theme_function_1',
    'container_theme_function_2',
    'container_theme_function_3',
  ];
  $variables = [
    'content' => 'test',
  ];
  $hook = 'container';
  hook_event_dispatcher_theme_suggestions_alter($suggestions, $variables, $hook);

  /** @var \Drupal\hook_event_dispatcher\Event\Theme\ThemeSuggestionsAlterEvent $event */
  $event = $this->manager
    ->getRegisteredEvent(HookEventDispatcherInterface::THEME_SUGGESTIONS_ALTER);
  self::assertEquals($suggestions, $event
    ->getSuggestions());
  self::assertEquals($variables, $event
    ->getVariables());
}