function ThemeInstallerTest::testUninstallBaseBeforeSubTheme
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testUninstallBaseBeforeSubTheme()
- 8.9.x core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testUninstallBaseBeforeSubTheme()
- 10 core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testUninstallBaseBeforeSubTheme()
Tests uninstalling a base theme before its sub-theme.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ ThemeInstallerTest.php, line 329
Class
- ThemeInstallerTest
- Tests installing and uninstalling of themes.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testUninstallBaseBeforeSubTheme() : void {
$name = 'test_base_theme';
$sub_name = 'test_subtheme';
$this->themeInstaller()
->install([
$sub_name,
]);
try {
$message = 'ThemeInstaller::install() throws InvalidArgumentException upon uninstalling base theme before sub theme.';
$this->themeInstaller()
->uninstall([
$name,
]);
$this->fail($message);
} catch (\Exception $e) {
$this->assertInstanceOf(\InvalidArgumentException::class, $e);
}
$themes = $this->themeHandler()
->listInfo();
$this->assertTrue(isset($themes[$name]));
$this->assertTrue(isset($themes[$sub_name]));
// Verify that uninstalling both at the same time works.
$this->themeInstaller()
->uninstall([
$name,
$sub_name,
]);
$themes = $this->themeHandler()
->listInfo();
$this->assertFalse(isset($themes[$name]));
$this->assertFalse(isset($themes[$sub_name]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.