You are here

protected function ThemeUiTest::assertUninstallableTheme in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php \Drupal\Tests\system\Functional\Theme\ThemeUiTest::assertUninstallableTheme()

Checks related to uninstallable themes due to module dependencies.

Parameters

string[] $expected_requires_list_items: The modules listed as being required to install the theme.

string $theme_name: The name of the theme.

1 call to ThemeUiTest::assertUninstallableTheme()
ThemeUiTest::testThemeInstallWithModuleDependencies in core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php
Tests installing a theme with module dependencies.

File

core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php, line 289

Class

ThemeUiTest
Tests the theme UI.

Namespace

Drupal\Tests\system\Functional\Theme

Code

protected function assertUninstallableTheme(array $expected_requires_list_items, $theme_name) {
  $theme_container = $this
    ->getSession()
    ->getPage()
    ->find('css', "h3:contains(\"{$theme_name}\")")
    ->getParent();
  $requires_list_items = $theme_container
    ->findAll('css', '.theme-info__requires li');
  $this
    ->assertSameSize($expected_requires_list_items, $requires_list_items);
  foreach ($requires_list_items as $key => $item) {
    $this
      ->assertContains($item
      ->getText(), $expected_requires_list_items);
  }
  $incompatible = $theme_container
    ->find('css', '.incompatible');
  $expected_incompatible_text = 'This theme requires the listed modules to operate correctly. They must first be enabled via the Extend page.';
  $this
    ->assertSame($expected_incompatible_text, $incompatible
    ->getText());
  $this
    ->assertFalse($theme_container
    ->hasLink('Install Test Theme Depending on Modules theme'));
}