You are here

public function ThemeExtensionListTest::testGetBaseThemes in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php \Drupal\Tests\Core\Extension\ThemeExtensionListTest::testGetBaseThemes()
  2. 9 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 providerTestGetBaseThemes

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 121

Class

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

Namespace

Drupal\Tests\Core\Extension

Code

public function testGetBaseThemes(array $themes, $theme, array $expected) {

  // Mocks and stubs.
  $module_handler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $state = new State(new KeyValueMemoryFactory(), new MemoryBackend(), 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');
  $base_themes = $theme_listing
    ->getBaseThemes($themes, $theme);
  $this
    ->assertEquals($expected, $base_themes);
}