function ActiveThemeLegacyTest::testConstructor

Tests BC layer in constructor.

@covers ::__construct @expectedDeprecation The 'base_themes' key is deprecated in Drupal 8.7.0 and support for it will be removed in Drupal 9.0.0. Use 'base_theme_extensions' instead. See https://www.drupal.org/node/3019948

File

core/tests/Drupal/KernelTests/Core/Theme/ActiveThemeLegacyTest.php, line 50

Class

ActiveThemeLegacyTest
Tests legacy code in ActiveTheme.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testConstructor() {
    $themes = $this->container
        ->get('extension.list.theme')
        ->getList();
    $values = [
        'name' => $themes['test_basetheme']->getName(),
        'extension' => $themes['test_basetheme'],
    ];
    $base_active_theme = new ActiveTheme($values);
    $values = [
        'name' => $themes['test_subtheme']->getName(),
        'extension' => $themes['test_subtheme'],
        'base_themes' => [
            'test_basetheme' => $base_active_theme,
        ],
    ];
    $active_theme = new ActiveTheme($values);
    $base_extensions = $active_theme->getBaseThemeExtensions();
    $this->assertSame($base_extensions['test_basetheme'], $themes['test_basetheme']);
    $this->assertSame([
        'test_basetheme',
    ], array_keys($base_extensions));
}

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