public function RegistryTest::testThemeRegistryAlterByTheme in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testThemeRegistryAlterByTheme()
- 9 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']);
}