You are here

public function StableUninstallUpdateTest::testUpdateStableNeeded in Drupal 9

Ensures that updates run without errors when Stable is still needed.

File

core/modules/system/tests/src/Functional/Update/StableUninstallUpdateTest.php, line 74

Class

StableUninstallUpdateTest
Ensures that update hook uninstalls Stable when it's no longer needed.

Namespace

Drupal\Tests\system\Functional\Update

Code

public function testUpdateStableNeeded() {

  /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
  $theme_handler = $this->container
    ->get('theme_handler');

  /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
  $theme_installer = $this->container
    ->get('theme_installer');
  $theme_installer
    ->install([
    'test_theme_depending_on_stable',
  ]);
  $this
    ->assertTrue($theme_handler
    ->themeExists('stable'));
  $this
    ->runUpdates();

  // Ensure that Stable is still installed after running tests.
  $theme_handler
    ->refreshInfo();
  $this
    ->assertTrue($theme_handler
    ->themeExists('stable'));
}