Commit f33b2415 authored by catch's avatar catch

Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy,...

Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy, ravi.khetri, jyotisankar, sudhanshug, jaredsmith, nesta_: Disable themes when theme engine or base theme aren't available
parent 45689e4b
......@@ -245,8 +245,8 @@ public function themesPage() {
// content has a common place in all themes.
$theme->incompatible_region = !isset($theme->info['regions']['content']);
$theme->incompatible_php = version_compare(phpversion(), $theme->info['php']) < 0;
// Confirmed that the base theme is available.
$theme->incompatible_base = isset($theme->info['base theme']) && !isset($themes[$theme->info['base theme']]);
// Confirm that all base themes are available.
$theme->incompatible_base = (isset($theme->info['base theme']) && !($theme->base_themes === array_filter($theme->base_themes)));
// Confirm that the theme engine is available.
$theme->incompatible_engine = isset($theme->info['engine']) && !isset($theme->owner);
}
......
......@@ -319,6 +319,9 @@ function testSwitchDefaultTheme() {
/**
* Test 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.
*/
function testInvalidTheme() {
// theme_page_test_system_info_alter() un-hides all hidden themes.
......@@ -327,6 +330,7 @@ function testInvalidTheme() {
$this->container->get('theme_handler')->reset();
$this->drupalGet('admin/appearance');
$this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', array('@base_theme' => 'not_real_test_basetheme')));
$this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', array('@base_theme' => 'test_invalid_basetheme')));
$this->assertText(t('This theme requires the theme engine @theme_engine to operate correctly.', array('@theme_engine' => 'not_real_engine')));
// Check for the error text of a theme with the wrong core version.
$this->assertText("This theme is not compatible with Drupal 8.x. Check that the .info.yml file contains the correct 'core' value.");
......
name: 'Theme test with valid base theme but no grandparent base theme'
type: theme
description: 'Test theme which has a non-existent base theme in the base chain.'
version: VERSION
core: 8.x
base theme: test_invalid_basetheme
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment