function ThemeUninstallConfirmTest::testCannotUninstallAdminTheme

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

Tests that the admin theme cannot be uninstalled.

File

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

Class

ThemeUninstallConfirmTest
Tests the theme uninstall confirmation form.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testCannotUninstallAdminTheme() : void {
  \Drupal::service('theme_installer')->install([
    'claro',
  ]);
  $this->config('system.theme')
    ->set('admin', 'claro')
    ->save();
  $this->drupalGet('admin/appearance/uninstall', [
    'query' => [
      'theme' => 'claro',
    ],
  ]);
  $this->assertSession()
    ->addressEquals('admin/appearance');
  $this->assertSession()
    ->pageTextContains('Claro is the admin theme and cannot be uninstalled');
  \Drupal::service('theme_handler')->refreshInfo();
  $themes = \Drupal::service('theme_handler')->listInfo();
  $this->assertNotEmpty($themes['claro']->status);
}

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