You are here

public function ThemeInstallerTest::testUninstall in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testUninstall()

Tests uninstalling a theme.

File

core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php, line 339

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testUninstall() {
  $name = 'test_basetheme';
  $this
    ->themeInstaller()
    ->install([
    $name,
  ]);
  $this
    ->assertNotEmpty($this
    ->config("{$name}.settings")
    ->get());
  $this
    ->themeInstaller()
    ->uninstall([
    $name,
  ]);
  $this
    ->assertEmpty(array_keys($this
    ->themeHandler()
    ->listInfo()));
  $this
    ->assertEmpty($this
    ->config("{$name}.settings")
    ->get());

  // Ensure that the uninstalled theme can be installed again.
  $this
    ->themeInstaller()
    ->install([
    $name,
  ]);
  $themes = $this
    ->themeHandler()
    ->listInfo();
  $this
    ->assertTrue(isset($themes[$name]));
  $this
    ->assertEqual($themes[$name]
    ->getName(), $name);
  $this
    ->assertNotEmpty($this
    ->config("{$name}.settings")
    ->get());
}