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\ExtensionCode
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);
}