3 namespace Drupal\KernelTests\Core\Theme;
5 use Drupal\KernelTests\KernelTestBase;
8 * Tests themes and base themes are correctly loaded.
12 class MaintenanceThemeTest extends KernelTestBase {
15 * Tests that the maintenance theme initializes the theme and its base themes.
17 public function testMaintenanceTheme() {
18 $this->setSetting('maintenance_theme', 'seven');
19 // Get the maintenance theme loaded.
20 drupal_maintenance_theme();
22 // Do we have an active theme?
23 $this->assertTrue(\Drupal::theme()->hasActiveTheme());
25 $active_theme = \Drupal::theme()->getActiveTheme();
26 $this->assertEquals('seven', $active_theme->getName());
28 $base_themes = $active_theme->getBaseThemes();
29 $base_theme_names = array_keys($base_themes);
30 $this->assertSame(['classy', 'stable'], $base_theme_names);
32 // Ensure Classy has the correct base themes and amount of base themes.
33 $classy_base_themes = $base_themes['classy']->getBaseThemes();
34 $classy_base_theme_names = array_keys($classy_base_themes);
35 $this->assertSame(['stable'], $classy_base_theme_names);