function ThemeInstallerTest::testUninstall

Same name 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. 10 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 372

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testUninstall() : void {
    $name = 'test_base_theme';
    $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.