public function RegistryTest::testMultipleSubThemes in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Theme/RegistryTest.php \Drupal\system\Tests\Theme\RegistryTest::testMultipleSubThemes()
Tests the theme registry with multiple subthemes.
File
- core/
modules/ system/ src/ Tests/ Theme/ RegistryTest.php, line 71 - Contains \Drupal\system\Tests\Theme\RegistryTest.
Class
- RegistryTest
- Tests the behavior of the ThemeRegistry class.
Namespace
Drupal\system\Tests\ThemeCode
public function testMultipleSubThemes() {
$theme_handler = \Drupal::service('theme_handler');
$theme_handler
->install([
'test_basetheme',
'test_subtheme',
'test_subsubtheme',
]);
$registry_subsub_theme = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_subsubtheme');
$registry_subsub_theme
->setThemeManager(\Drupal::theme());
$registry_sub_theme = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_subtheme');
$registry_sub_theme
->setThemeManager(\Drupal::theme());
$registry_base_theme = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_basetheme');
$registry_base_theme
->setThemeManager(\Drupal::theme());
$preprocess_functions = $registry_subsub_theme
->get()['theme_test_template_test']['preprocess functions'];
$this
->assertIdentical([
'template_preprocess',
'test_basetheme_preprocess_theme_test_template_test',
'test_subtheme_preprocess_theme_test_template_test',
'test_subsubtheme_preprocess_theme_test_template_test',
], $preprocess_functions);
$preprocess_functions = $registry_sub_theme
->get()['theme_test_template_test']['preprocess functions'];
$this
->assertIdentical([
'template_preprocess',
'test_basetheme_preprocess_theme_test_template_test',
'test_subtheme_preprocess_theme_test_template_test',
], $preprocess_functions);
$preprocess_functions = $registry_base_theme
->get()['theme_test_template_test']['preprocess functions'];
$this
->assertIdentical([
'template_preprocess',
'test_basetheme_preprocess_theme_test_template_test',
], $preprocess_functions);
$preprocess_functions = $registry_base_theme
->get()['theme_test_function_suggestions']['preprocess functions'];
$this
->assertIdentical([
'template_preprocess_theme_test_function_suggestions',
'test_basetheme_preprocess_theme_test_function_suggestions',
], $preprocess_functions, "Theme functions don't have template_preprocess but do have template_preprocess_HOOK");
}