function RegistryTest::testThemeRegistryAlterByTheme
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testThemeRegistryAlterByTheme()
- 10 core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testThemeRegistryAlterByTheme()
- 11.x core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testThemeRegistryAlterByTheme()
Tests that the theme registry can be altered by themes.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ RegistryTest.php, line 148
Class
- RegistryTest
- Tests the behavior of the ThemeRegistry class.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testThemeRegistryAlterByTheme() {
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
$theme_handler = \Drupal::service('theme_handler');
\Drupal::service('theme_installer')->install([
'test_theme',
]);
$this->config('system.theme')
->set('default', 'test_theme')
->save();
$extension_list = $this->container
->get('extension.list.module');
assert($extension_list instanceof ModuleExtensionList);
$registry = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), \Drupal::service('cache.bootstrap'), $extension_list, 'test_theme');
$registry->setThemeManager(\Drupal::theme());
$this->assertEquals('value', $registry->get()['theme_test_template_test']['variables']['additional']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.