You are here

protected function ThemeUiTest::assertUninstallableTheme in Drupal 10

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()
  2. 9 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.

@internal

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 291

Class

ThemeUiTest
Tests the theme UI.

Namespace

Drupal\Tests\system\Functional\Theme

Code

protected function assertUninstallableTheme(array $expected_requires_list_items, string $theme_name) : void {
  $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'));
}