function ThemeUiTest::assertUninstallableTheme

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php \Drupal\Tests\system\Functional\Theme\ThemeUiTest::assertUninstallableTheme()
  2. 10 core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php \Drupal\Tests\system\Functional\Theme\ThemeUiTest::assertUninstallableTheme()
  3. 11.x 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 285

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->assertCount(count($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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.