function ThemeTest::testInvalidTheme
Same name in other branches
- 9 core/modules/system/tests/src/Functional/System/ThemeTest.php \Drupal\Tests\system\Functional\System\ThemeTest::testInvalidTheme()
- 8.9.x core/modules/system/tests/src/Functional/System/ThemeTest.php \Drupal\Tests\system\Functional\System\ThemeTest::testInvalidTheme()
- 10 core/modules/system/tests/src/Functional/System/ThemeTest.php \Drupal\Tests\system\Functional\System\ThemeTest::testInvalidTheme()
Tests themes can't be installed when the base theme or engine is missing.
Include test for themes that have a missing base theme somewhere further up the chain than the immediate base theme.
File
-
core/
modules/ system/ tests/ src/ Functional/ System/ ThemeTest.php, line 460
Class
- ThemeTest
- Tests the theme administration user interface.
Namespace
Drupal\Tests\system\Functional\SystemCode
public function testInvalidTheme() : void {
// theme_page_test_system_info_alter() un-hides all hidden themes.
$this->container
->get('module_installer')
->install([
'theme_page_test',
]);
// Clear the system_list() and theme listing cache to pick up the change.
$this->container
->get('theme_handler')
->reset();
$this->drupalGet('admin/appearance');
$this->assertSession()
->pageTextContains('This theme requires the base theme not_real_test_base_theme to operate correctly.');
$this->assertSession()
->pageTextContains('This theme requires the base theme test_invalid_base_theme to operate correctly.');
$this->assertSession()
->pageTextContains('This theme requires the theme engine not_real_engine to operate correctly.');
// Check for the error text of a theme with the wrong core version
// using 7.x and ^7.
$incompatible_core_message = 'This theme is not compatible with Drupal ' . \Drupal::VERSION . ". Check that the .info.yml file contains a compatible 'core' or 'core_version_requirement' value.";
$this->assertThemeIncompatibleText('Theme test with invalid semver core version', $incompatible_core_message);
// Check for the error text of a theme without a content region.
$this->assertSession()
->pageTextContains("This theme is missing a 'content' region.");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.