function RegistryTest::testThemeTemplatesRegisteredByModules
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testThemeTemplatesRegisteredByModules()
- 8.9.x core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testThemeTemplatesRegisteredByModules()
- 11.x core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testThemeTemplatesRegisteredByModules()
Tests theme-provided templates that are registered by modules.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ RegistryTest.php, line 260
Class
- RegistryTest
- Tests the behavior of the ThemeRegistry class.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testThemeTemplatesRegisteredByModules() : void {
$theme_handler = \Drupal::service('theme_handler');
\Drupal::service('theme_installer')->install([
'test_theme',
]);
$extension_list = \Drupal::service('extension.list.module');
assert($extension_list instanceof ModuleExtensionList);
$registry_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), \Drupal::service('cache.bootstrap'), $extension_list, \Drupal::service('kernel'), 'test_theme');
$registry_theme->setThemeManager(\Drupal::theme());
$expected = [
'template_preprocess',
'template_preprocess_container',
'template_preprocess_theme_test_registered_by_module',
];
$registry = $registry_theme->get();
$this->assertEquals($expected, array_values($registry['theme_test_registered_by_module']['preprocess functions']));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.