You are here

public function ThemeEventTest::testThemeEventWithAddNewThemeWithPathException in Hook Event Dispatcher 8

ThemeEvent with addNewTheme test.

File

tests/src/Unit/Theme/ThemeEventTest.php, line 144

Class

ThemeEventTest
Class ThemeEventTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Theme

Code

public function testThemeEventWithAddNewThemeWithPathException() {
  $themeHook = 'extra_theme__hook';
  $information = [
    'test' => 'extra_theme_information',
  ];
  $this->manager
    ->setEventCallbacks([
    HookEventDispatcherInterface::THEME => function (ThemeEvent $event) use ($themeHook, $information) {
      $event
        ->addNewTheme($themeHook, $information);
    },
  ]);
  $this
    ->expectException(\RuntimeException::class);
  $this
    ->expectExceptionMessage('Missing path in the information array. ThemeEvent needs the path to be set manually, to have a proper default theme implementation. See \\hook_theme() for more information.');
  hook_event_dispatcher_theme([]);
}