class BaseThemeRequiredTest in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php \Drupal\KernelTests\Core\Theme\BaseThemeRequiredTest
- 9 core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php \Drupal\KernelTests\Core\Theme\BaseThemeRequiredTest
Tests the behavior of the `base theme` key.
@group Theme
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\KernelTests\Core\Theme\BaseThemeRequiredTest
Expanded class hierarchy of BaseThemeRequiredTest
File
- core/
tests/ Drupal/ KernelTests/ Core/ Theme/ BaseThemeRequiredTest.php, line 12
Namespace
Drupal\KernelTests\Core\ThemeView source
class BaseThemeRequiredTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
];
/**
* The theme installer.
*
* @var \Drupal\Core\Extension\ThemeInstallerInterface
*/
protected $themeInstaller;
/**
* The theme manager.
*
* @var \Drupal\Core\Theme\ThemeManagerInterface
*/
protected $themeManager;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->themeInstaller = $this->container
->get('theme_installer');
$this->themeManager = $this->container
->get('theme.manager');
}
/**
* Tests opting out of Stable by setting the base theme to false.
*/
public function testWildWest() {
$this->themeInstaller
->install([
'test_wild_west',
]);
$this
->config('system.theme')
->set('default', 'test_wild_west')
->save();
$theme = $this->themeManager
->getActiveTheme();
/** @var \Drupal\Core\Theme\ActiveTheme $base_theme */
$base_themes = $theme
->getBaseThemeExtensions();
$this
->assertEmpty($base_themes, 'No base theme is set when a theme has opted out of using Stable.');
}
}