function ThemeUninstallConfirmTest::testThemeUninstallConfirmForm

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

Tests the theme uninstall confirmation form basic workflow.

File

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

Class

ThemeUninstallConfirmTest
Tests the theme uninstall confirmation form.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testThemeUninstallConfirmForm() : void {
  \Drupal::service('theme_installer')->install([
    'claro',
  ]);
  $this->drupalGet('admin/appearance');
  $this->clickLink('Uninstall Claro theme');
  $this->drupalGet('admin/appearance/uninstall', [
    'query' => [
      'theme' => 'claro',
    ],
  ]);
  $this->assertSession()
    ->pageTextContains('Uninstall Claro theme');
  $this->assertSession()
    ->pageTextContains('The Claro theme will be completely uninstalled from your site, and all data from this theme will be lost!');
  $this->assertSession()
    ->buttonExists('Uninstall');
  $this->assertSession()
    ->linkExists('Cancel');
  $this->submitForm([], 'Uninstall');
  $this->assertSession()
    ->pageTextContains('The Claro theme has been uninstalled');
  $this->assertSession()
    ->addressEquals('admin/appearance');
  $this->assertSession()
    ->linkExists('Install Claro theme');
  \Drupal::service('theme_handler')->refreshInfo();
  $themes = \Drupal::service('theme_handler')->listInfo();
  $this->assertArrayNotHasKey('claro', $themes);
}

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