function ThemeInstallerTest::testThemeInfoAlter
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testThemeInfoAlter()
- 10 core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testThemeInfoAlter()
- 11.x core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testThemeInfoAlter()
Tests that theme info can be altered by a module.
See also
module_test_system_info_alter()
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ ThemeInstallerTest.php, line 396
Class
- ThemeInstallerTest
- Tests installing and uninstalling of themes.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testThemeInfoAlter() {
$name = 'stark';
$this->container
->get('state')
->set('module_test.hook_system_info_alter', TRUE);
$this->themeInstaller()
->install([
$name,
]);
$themes = $this->themeHandler()
->listInfo();
$this->assertFalse(isset($themes[$name]->info['regions']['test_region']));
// Install module_test.
$this->moduleInstaller()
->install([
'module_test',
], FALSE);
$this->assertTrue($this->moduleHandler()
->moduleExists('module_test'));
$themes = $this->themeHandler()
->listInfo();
$this->assertTrue(isset($themes[$name]->info['regions']['test_region']));
// Legacy assertions.
// @todo Remove once theme initialization/info has been modernized.
// @see https://www.drupal.org/node/2228093
$info = \Drupal::service('extension.list.theme')->getExtensionInfo($name);
$this->assertTrue(isset($info['regions']['test_region']));
$regions = system_region_list($name);
$this->assertTrue(isset($regions['test_region']));
$theme_list = \Drupal::service('theme_handler')->listInfo();
$this->assertTrue(isset($theme_list[$name]->info['regions']['test_region']));
$this->moduleInstaller()
->uninstall([
'module_test',
]);
$this->assertFalse($this->moduleHandler()
->moduleExists('module_test'));
$themes = $this->themeHandler()
->listInfo();
$this->assertFalse(isset($themes[$name]->info['regions']['test_region']));
// Legacy assertions.
// @todo Remove once theme initialization/info has been modernized.
// @see https://www.drupal.org/node/2228093
$info = \Drupal::service('extension.list.theme')->getExtensionInfo($name);
$this->assertFalse(isset($info['regions']['test_region']));
$regions = system_region_list($name);
$this->assertFalse(isset($regions['test_region']));
$theme_list = \Drupal::service('theme_handler')->listInfo();
$this->assertFalse(isset($theme_list[$name]->info['regions']['test_region']));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.