Same name and namespace in other branches
  1. 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.

@group Theme

Hierarchy

  • 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\Theme
View source
class BaseThemeMissingTest extends KernelTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'system',
  ];

  /**
   * 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() {
    $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',
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BaseThemeMissingTest::$modules protected static property
BaseThemeMissingTest::$themeInstaller protected property The theme installer.
BaseThemeMissingTest::setUp protected function
BaseThemeMissingTest::testMissingBaseThemeException public function Tests exception is thrown.