ClassyUninstallUpdateTest.php in Drupal 9
File
core/modules/system/tests/src/Functional/Update/ClassyUninstallUpdateTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class ClassyUninstallUpdateTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../fixtures/update/drupal-8.8.0.bare.standard.php.gz',
];
}
public function testUpdate() {
$theme_handler = $this->container
->get('theme_handler');
$this
->assertTrue($theme_handler
->themeExists('classy'));
$this
->assertTrue($theme_handler
->themeExists('seven'));
$this
->runUpdates();
$theme_handler
->refreshInfo();
$this
->assertFalse($theme_handler
->themeExists('classy'));
$this
->assertTrue($theme_handler
->themeExists('seven'));
}
public function testUpdateClassyNotInstalled() {
$theme_handler = $this->container
->get('theme_handler');
$theme_list = array_keys($theme_handler
->listInfo());
$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();
$theme_installer
->uninstall($theme_list);
$theme_handler
->refreshInfo();
$this
->assertFalse($theme_handler
->themeExists('classy'));
$this
->runUpdates();
$theme_handler
->refreshInfo();
$this
->assertFalse($theme_handler
->themeExists('classy'));
}
public function testUpdateClassyNeeded() {
$theme_handler = $this->container
->get('theme_handler');
$theme_installer = $this->container
->get('theme_installer');
$theme_installer
->install([
'test_theme',
]);
$this
->assertTrue($theme_handler
->themeExists('classy'));
$this
->runUpdates();
$theme_handler
->refreshInfo();
$this
->assertTrue($theme_handler
->themeExists('classy'));
}
}