function ThemeHandlerTest::testRebuildThemeData
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php \Drupal\Tests\Core\Extension\ThemeHandlerTest::testRebuildThemeData()
- 8.9.x core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php \Drupal\Tests\Core\Extension\ThemeHandlerTest::testRebuildThemeData()
- 10 core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php \Drupal\Tests\Core\Extension\ThemeHandlerTest::testRebuildThemeData()
Tests rebuilding the theme data.
@group legacy
See also
\Drupal\Core\Extension\ThemeHandler::rebuildThemeData()
File
-
core/
tests/ Drupal/ Tests/ Core/ Extension/ ThemeHandlerTest.php, line 74
Class
- ThemeHandlerTest
- @coversDefaultClass \Drupal\Core\Extension\ThemeHandler @group Extension
Namespace
Drupal\Tests\Core\ExtensionCode
public function testRebuildThemeData() : void {
$this->expectDeprecation("\\Drupal\\Core\\Extension\\ThemeHandlerInterface::rebuildThemeData() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \\Drupal::service('extension.list.theme')->reset()->getList() instead. See https://www.drupal.org/node/3413196");
$this->themeList
->expects($this->once())
->method('reset')
->willReturnSelf();
$this->themeList
->expects($this->once())
->method('getList')
->willReturn([
'stark' => new Extension($this->root, 'theme', 'core/themes/stark/stark.info.yml', 'stark.theme'),
]);
$theme_data = $this->themeHandler
->rebuildThemeData();
$this->assertCount(1, $theme_data);
$info = $theme_data['stark'];
// Ensure some basic properties.
$this->assertInstanceOf('Drupal\\Core\\Extension\\Extension', $info);
$this->assertEquals('stark', $info->getName());
$this->assertEquals('core/themes/stark/stark.info.yml', $info->getPathname());
$this->assertEquals('core/themes/stark/stark.theme', $info->getExtensionPathname());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.