function ThemeExtensionListTest::testGetBaseThemes

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php \Drupal\Tests\Core\Extension\ThemeExtensionListTest::testGetBaseThemes()
  2. 8.9.x core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php \Drupal\Tests\Core\Extension\ThemeExtensionListTest::testGetBaseThemes()
  3. 11.x core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php \Drupal\Tests\Core\Extension\ThemeExtensionListTest::testGetBaseThemes()

Tests getting the base themes for a set a defines themes.

@dataProvider providerTestDoGetBaseThemes

@group legacy

Parameters

array $themes: An array of available themes, keyed by the theme name.

string $theme: The theme name to find all its base themes.

array $expected: The expected base themes.

File

core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php, line 124

Class

ThemeExtensionListTest
@coversDefaultClass \Drupal\Core\Extension\ThemeExtensionList @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function testGetBaseThemes(array $themes, $theme, array $expected) : void {
    // Mocks and stubs.
    $module_handler = $this->prophesize(ModuleHandlerInterface::class);
    $state = new State(new KeyValueMemoryFactory(), new NullBackend('bin'), new NullLockBackend());
    $config_factory = $this->getConfigFactoryStub([]);
    $theme_engine_list = $this->prophesize(ThemeEngineExtensionList::class);
    $theme_listing = new ThemeExtensionList($this->root, 'theme', new NullBackend('test'), new InfoParser($this->root), $module_handler->reveal(), $state, $config_factory, $theme_engine_list->reveal(), 'test');
    $this->expectDeprecation("\\Drupal\\Core\\Extension\\ThemeExtensionList::getBaseThemes() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. There is no direct replacement. See https://www.drupal.org/node/3413187");
    $base_themes = $theme_listing->getBaseThemes($themes, $theme);
    $this->assertEquals($expected, $base_themes);
}

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