public function StableUninstallUpdateTest::testUpdateStableNotInstalled in Drupal 9
Ensures that updates run without errors when Stable is not installed.
File
- core/
modules/ system/ tests/ src/ Functional/ Update/ StableUninstallUpdateTest.php, line 44
Class
- StableUninstallUpdateTest
- Ensures that update hook uninstalls Stable when it's no longer needed.
Namespace
Drupal\Tests\system\Functional\UpdateCode
public function testUpdateStableNotInstalled() {
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
$theme_handler = $this->container
->get('theme_handler');
$theme_list = array_keys($theme_handler
->listInfo());
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
$theme_installer = $this->container
->get('theme_installer');
$theme_installer
->install([
'stark',
]);
$this->container
->get('config.factory')
->getEditable('system.theme')
->set('default', 'stark')
->set('admin', '')
->save();
$theme_handler
->refreshInfo();
// Uninstall all themes that were installed prior to enabling Stark.
$theme_installer
->uninstall($theme_list);
// Ensure that Stable is not installed anymore.
$theme_handler
->refreshInfo();
$this
->assertFalse($theme_handler
->themeExists('stable'));
$this
->runUpdates();
$theme_handler
->refreshInfo();
$this
->assertFalse($theme_handler
->themeExists('stable'));
}