function LibraryDiscoveryIntegrationTest::activateTheme
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::activateTheme()
- 10 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::activateTheme()
- 11.x core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::activateTheme()
Activates a specified theme.
Installs the theme if not already installed and makes it the active theme.
Parameters
string $theme_name: The name of the theme to be activated.
7 calls to LibraryDiscoveryIntegrationTest::activateTheme()
- LibraryDiscoveryIntegrationTest::testBaseThemeLibrariesOverrideInSubTheme in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php - Tests that base theme libraries-override still apply in sub themes.
- LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php - Tests that hook_library_info is invoked and the cache is cleared.
- LibraryDiscoveryIntegrationTest::testLibrariesExtend in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php - Tests libraries-extend.
- LibraryDiscoveryIntegrationTest::testLibrariesOverride in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php - Tests that libraries-override are applied to library definitions.
- LibraryDiscoveryIntegrationTest::testLibrariesOverrideDrupalSettings in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php - Tests libraries-override on drupalSettings.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php, line 219
Class
- LibraryDiscoveryIntegrationTest
- Tests the library discovery and library discovery parser.
Namespace
Drupal\KernelTests\Core\AssetCode
protected function activateTheme($theme_name) {
$this->container
->get('theme_installer')
->install([
$theme_name,
]);
/** @var \Drupal\Core\Theme\ThemeInitializationInterface $theme_initializer */
$theme_initializer = $this->container
->get('theme.initialization');
/** @var \Drupal\Core\Theme\ThemeManagerInterface $theme_manager */
$theme_manager = $this->container
->get('theme.manager');
$theme_manager->setActiveTheme($theme_initializer->getActiveThemeByName($theme_name));
$this->libraryDiscovery
->clearCachedDefinitions();
$this->assertSame($theme_name, $theme_manager->getActiveTheme()
->getName());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.