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. 10 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 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());
}

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