You are here

protected function InstallUninstallTest::assertUninstallModuleUpdates in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php \Drupal\Tests\system\Functional\Module\InstallUninstallTest::assertUninstallModuleUpdates()
  2. 9 core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php \Drupal\Tests\system\Functional\Module\InstallUninstallTest::assertUninstallModuleUpdates()

Asserts the module post update functions after uninstall.

@internal

Parameters

string $module: The module that got installed.

1 call to InstallUninstallTest::assertUninstallModuleUpdates()
InstallUninstallTest::assertSuccessfulUninstall in core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php
Uninstalls a module and asserts that it was done correctly.

File

core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php, line 380

Class

InstallUninstallTest
Install/uninstall core module and confirm table creation/deletion.

Namespace

Drupal\Tests\system\Functional\Module

Code

protected function assertUninstallModuleUpdates(string $module) : void {

  /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */
  $post_update_registry = \Drupal::service('update.post_update_registry');
  $all_update_functions = $post_update_registry
    ->getPendingUpdateFunctions();
  switch ($module) {
    case 'update_test_postupdate':
      $this
        ->assertEmpty(array_intersect([
        'update_test_postupdate_post_update_first',
      ], $all_update_functions), 'Asserts that no pending post update functions are available.');
      $existing_updates = \Drupal::keyValue('post_update')
        ->get('existing_updates', []);
      $this
        ->assertEmpty(array_intersect([
        'update_test_postupdate_post_update_first',
      ], $existing_updates), 'Asserts that no post update functions are stored in keyvalue store.');
      break;
  }
}