public function ThemeEventTest::testThemeEventWithAddNewThemesPathException in Hook Event Dispatcher 8
ThemeEvent with addNewThemes test.
File
- tests/
src/ Unit/ Theme/ ThemeEventTest.php, line 82
Class
- ThemeEventTest
- Class ThemeEventTest.
Namespace
Drupal\Tests\hook_event_dispatcher\Unit\ThemeCode
public function testThemeEventWithAddNewThemesPathException() {
$newThemes = [
'some_custom__hook_theme' => [
'variables' => [
'custom_variable' => NULL,
],
],
];
$this->manager
->setEventCallbacks([
HookEventDispatcherInterface::THEME => function (ThemeEvent $event) use ($newThemes) {
$event
->addNewThemes($newThemes);
},
]);
$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([]);
}