function RegistryTest::testMultipleSubThemes
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testMultipleSubThemes()
- 10 core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testMultipleSubThemes()
- 9 core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testMultipleSubThemes()
- 8.9.x core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testMultipleSubThemes()
Tests the theme registry with multiple subthemes.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ RegistryTest.php, line 78
Class
- RegistryTest
- Tests the behavior of the ThemeRegistry class.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testMultipleSubThemes() : void {
\Drupal::service('theme_installer')->install([
'test_base_theme',
'test_subtheme',
'test_subsubtheme',
]);
$registry_theme = \Drupal::service(Registry::class);
\Drupal::theme()->setActiveTheme(\Drupal::service(ThemeInitializationInterface::class)->initTheme('test_subsubtheme'));
$preprocess_functions = $registry_theme->get()['theme_test_template_test']['preprocess functions'];
$this->assertSame([
'test_base_theme_preprocess_theme_test_template_test',
'test_subtheme_preprocess_theme_test_template_test',
'test_subsubtheme_preprocess_theme_test_template_test',
], $preprocess_functions);
\Drupal::theme()->setActiveTheme(\Drupal::service(ThemeInitializationInterface::class)->initTheme('test_subtheme'));
$preprocess_functions = $registry_theme->get()['theme_test_template_test']['preprocess functions'];
$this->assertSame([
'test_base_theme_preprocess_theme_test_template_test',
'test_subtheme_preprocess_theme_test_template_test',
], $preprocess_functions);
\Drupal::theme()->setActiveTheme(\Drupal::service(ThemeInitializationInterface::class)->initTheme('test_base_theme'));
$preprocess_functions = $registry_theme->get()['theme_test_template_test']['preprocess functions'];
$this->assertSame([
'test_base_theme_preprocess_theme_test_template_test',
], $preprocess_functions);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.