ThemeExtensionListTest.php
Same filename in this branch
Same filename in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php
- 8.9.x core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php
- 10 core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php
- 10 core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php
- 11.x core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php
- 11.x core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php
Namespace
Drupal\KernelTests\Core\ExtensionFile
-
core/
tests/ Drupal/ KernelTests/ Core/ Extension/ ThemeExtensionListTest.php
View source
<?php
namespace Drupal\KernelTests\Core\Extension;
use Drupal\KernelTests\KernelTestBase;
/**
* @coversDefaultClass \Drupal\Core\Extension\ThemeExtensionList
* @group Extension
*/
class ThemeExtensionListTest extends KernelTestBase {
/**
* @covers ::getList
*/
public function testGetlist() {
\Drupal::configFactory()->getEditable('core.extension')
->set('module.testing', 1000)
->set('theme.test_theme', 0)
->save();
// The installation profile is provided by a container parameter.
// Saving the configuration doesn't automatically trigger invalidation
$this->container
->get('kernel')
->rebuildContainer();
/** @var \Drupal\Core\Extension\ThemeExtensionList $theme_extension_list */
$theme_extension_list = \Drupal::service('extension.list.theme');
$extensions = $theme_extension_list->getList();
$this->assertArrayHasKey('test_theme', $extensions);
}
/**
* Tests that themes have an empty default version set.
*/
public function testThemeWithoutVersion() {
$theme = \Drupal::service('extension.list.theme')->get('test_theme_settings_features');
$this->assertNull($theme->info['version']);
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
ThemeExtensionListTest | @coversDefaultClass \Drupal\Core\Extension\ThemeExtensionList @group Extension |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.