class BaseThemeMissingTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Theme/BaseThemeMissingTest.php \Drupal\KernelTests\Core\Theme\BaseThemeMissingTest
- 10 core/tests/Drupal/KernelTests/Core/Theme/BaseThemeMissingTest.php \Drupal\KernelTests\Core\Theme\BaseThemeMissingTest
- 9 core/tests/Drupal/KernelTests/Core/Theme/BaseThemeMissingTest.php \Drupal\KernelTests\Core\Theme\BaseThemeMissingTest
Tests the behavior of a theme when base_theme info key is missing.
Attributes
#[Group('Theme')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\Core\Theme\BaseThemeMissingTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of BaseThemeMissingTest
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ BaseThemeMissingTest.php, line 16
Namespace
Drupal\KernelTests\Core\ThemeView source
class BaseThemeMissingTest extends KernelTestBase {
/**
* The theme installer.
*
* @var \Drupal\Core\Extension\ThemeInstallerInterface
*/
protected $themeInstaller;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// Add a directory to extension discovery to find the theme with a missing
// base class.
// @see \Drupal\Core\Extension\ExtensionDiscovery::scan()
$settings = Settings::getAll();
$settings['test_parent_site'] = 'core/tests/fixtures/test_missing_base_theme';
new Settings($settings);
$this->themeInstaller = $this->container
->get('theme_installer');
}
/**
* Tests exception is thrown.
*/
public function testMissingBaseThemeException() : void {
$this->expectException(InfoParserException::class);
$this->expectExceptionMessage('Missing required key ("base theme") in core/tests/fixtures/test_missing_base_theme/test_missing_base_theme.info.yml, see https://www.drupal.org/node/3066038');
$this->themeInstaller
->install([
'test_missing_base_theme',
]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.