function ThemeUninstallConfirmTest::testCannotUninstallDefaultTheme

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Functional/Theme/ThemeUninstallConfirmTest.php \Drupal\Tests\system\Functional\Theme\ThemeUninstallConfirmTest::testCannotUninstallDefaultTheme()

Tests that the default theme cannot be uninstalled.

File

core/modules/system/tests/src/Functional/Theme/ThemeUninstallConfirmTest.php, line 71

Class

ThemeUninstallConfirmTest
Tests the theme uninstall confirmation form.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testCannotUninstallDefaultTheme() : void {
  $this->drupalGet("admin/appearance/uninstall", [
    'query' => [
      'theme' => 'stark',
    ],
  ]);
  $this->assertSession()
    ->addressEquals('admin/appearance');
  $this->assertSession()
    ->pageTextContains('Stark is the default theme and cannot be uninstalled');
  \Drupal::service('theme_handler')->refreshInfo();
  $themes = \Drupal::service('theme_handler')->listInfo();
  $this->assertNotEmpty($themes['stark']->status);
}

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