function BaseThemeDefaultDeprecationTest::testStableIsDefault

Ensures Stable is used by default when no base theme has been defined.

@group legacy @expectedDeprecation There is no `base theme` property specified in the test_stable.info.yml file. The optionality of the `base theme` property is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. All Drupal 8 themes must add `base theme: stable` to their *.info.yml file for them to continue to work as-is in future versions of Drupal. Drupal 9 requires the `base theme` property to be specified. See https://www.drupal.org/node/3066038

File

core/tests/Drupal/KernelTests/Core/Theme/BaseThemeDefaultDeprecationTest.php, line 86

Class

BaseThemeDefaultDeprecationTest
Tests the behavior of the Stable theme.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testStableIsDefault() {
    $this->container
        ->get('extension.list.theme')
        ->setExtensionDiscovery(new ExtensionDiscovery('vfs://core'))
        ->setInfoParser(new VfsInfoParser('vfs:/'));
    $this->themeInstaller
        ->install([
        'test_stable',
    ]);
    $this->config('system.theme')
        ->set('default', 'test_stable')
        ->save();
    $theme = $this->themeManager
        ->getActiveTheme();
    $base_themes = $theme->getBaseThemeExtensions();
    $base_theme = reset($base_themes);
    $this->assertTrue($base_theme->getName() == 'stable', "Stable theme is the base theme if a theme hasn't decided to opt out.");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.