You are here

function ThemeTest::testInvalidTheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/System/ThemeTest.php \Drupal\system\Tests\System\ThemeTest::testInvalidTheme()

Test themes can't be installed when the base theme or engine is missing.

File

core/modules/system/src/Tests/System/ThemeTest.php, line 304
Contains \Drupal\system\Tests\System\ThemeTest.

Class

ThemeTest
Tests the theme interface functionality by enabling and switching themes, and using an administration theme.

Namespace

Drupal\system\Tests\System

Code

function testInvalidTheme() {

  // theme_page_test_system_info_alter() un-hides all hidden themes.
  $this->container
    ->get('module_installer')
    ->install(array(
    '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
    ->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 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.");

  // Check for the error text of a theme without a content region.
  $this
    ->assertText("This theme is missing a 'content' region.");
}