function ThemeInstallerTest::testUninstall

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testUninstall()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testUninstall()
  3. 11.x 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 373

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testUninstall() : void {
  $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->assertEquals($name, $themes[$name]->getName());
  $this->assertNotEmpty($this->config("{$name}.settings")
    ->get());
}

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