function ThemeExtensionListTest::testDoGetBaseThemes

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php \Drupal\Tests\Core\Extension\ThemeExtensionListTest::testDoGetBaseThemes()

Tests getting the base themes for a set of defined themes.

@dataProvider providerTestDoGetBaseThemes

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 150

Class

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

Namespace

Drupal\Tests\Core\Extension

Code

public function testDoGetBaseThemes(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');
    $method_to_test = (new \ReflectionObject($theme_listing))->getMethod('doGetBaseThemes');
    $base_themes = $method_to_test->invoke($theme_listing, $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.