class MaintenanceThemeTest in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Theme/MaintenanceThemeTest.php \Drupal\KernelTests\Core\Theme\MaintenanceThemeTest
- 9 core/tests/Drupal/KernelTests/Core/Theme/MaintenanceThemeTest.php \Drupal\KernelTests\Core\Theme\MaintenanceThemeTest
Tests themes and base themes are correctly loaded.
@group Installer
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\KernelTests\Core\Theme\MaintenanceThemeTest
Expanded class hierarchy of MaintenanceThemeTest
File
- core/
tests/ Drupal/ KernelTests/ Core/ Theme/ MaintenanceThemeTest.php, line 12
Namespace
Drupal\KernelTests\Core\ThemeView source
class MaintenanceThemeTest extends KernelTestBase {
/**
* Tests that the maintenance theme initializes the theme and its base themes.
*/
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);
}
}