function MaintenanceThemeTest::testMaintenanceTheme
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Theme/MaintenanceThemeTest.php \Drupal\KernelTests\Core\Theme\MaintenanceThemeTest::testMaintenanceTheme()
- 10 core/tests/Drupal/KernelTests/Core/Theme/MaintenanceThemeTest.php \Drupal\KernelTests\Core\Theme\MaintenanceThemeTest::testMaintenanceTheme()
- 11.x core/tests/Drupal/KernelTests/Core/Theme/MaintenanceThemeTest.php \Drupal\KernelTests\Core\Theme\MaintenanceThemeTest::testMaintenanceTheme()
Tests that the maintenance theme initializes the theme and its base themes.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ MaintenanceThemeTest.php, line 17
Class
- MaintenanceThemeTest
- Tests themes and base themes are correctly loaded.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testMaintenanceTheme() {
$this->setSetting('maintenance_theme', 'test_subtheme');
// Get the maintenance theme loaded.
drupal_maintenance_theme();
// Do we have an active theme?
$this->assertTrue(\Drupal::theme()->hasActiveTheme());
$active_theme = \Drupal::theme()->getActiveTheme();
$this->assertEquals('test_subtheme', $active_theme->getName());
$base_themes = $active_theme->getBaseThemeExtensions();
$base_theme_names = array_keys($base_themes);
$this->assertSame([
'test_basetheme',
], $base_theme_names);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.