function ThemeUninstallConfirmTest::testCannotUninstallBaseThemeWithDependentSubThemes
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Functional/Theme/ThemeUninstallConfirmTest.php \Drupal\Tests\system\Functional\Theme\ThemeUninstallConfirmTest::testCannotUninstallBaseThemeWithDependentSubThemes()
Tests that a base theme with dependent sub-themes cannot be uninstalled.
File
-
core/
modules/ system/ tests/ src/ Functional/ Theme/ ThemeUninstallConfirmTest.php, line 101
Class
- ThemeUninstallConfirmTest
- Tests the theme uninstall confirmation form.
Namespace
Drupal\Tests\system\Functional\ThemeCode
public function testCannotUninstallBaseThemeWithDependentSubThemes() : void {
\Drupal::service('theme_installer')->install([
'test_base_theme',
'test_subtheme',
]);
$this->drupalGet('admin/appearance/uninstall', [
'query' => [
'theme' => 'test_base_theme',
],
]);
$this->assertSession()
->addressEquals('admin/appearance');
$this->assertSession()
->pageTextContains('Theme test base theme cannot be uninstalled because the following themes depend on it: Theme test subtheme');
$this->drupalGet('admin/appearance/uninstall', [
'query' => [
'theme' => 'test_subtheme',
],
]);
$this->submitForm([], 'Uninstall');
$this->assertSession()
->pageTextContains('The Theme test subtheme theme has been uninstalled');
$this->drupalGet('admin/appearance/uninstall', [
'query' => [
'theme' => 'test_base_theme',
],
]);
$this->submitForm([], 'Uninstall');
$this->assertSession()
->pageTextContains('The Theme test base theme theme has been uninstalled');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.