function InstallUninstallTest::assertUninstallModuleUpdates

Same name in other branches
  1. 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.

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 330

Class

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

Namespace

Drupal\Tests\system\Functional\Module

Code

protected function assertUninstallModuleUpdates($module) {
    
    /** @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 'block':
            $this->assertEmpty(array_intersect([
                'block_post_update_disable_blocks_with_missing_contexts',
            ], $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([
                'block_post_update_disable_blocks_with_missing_contexts',
            ], $existing_updates), 'Asserts that no post update functions are stored in keyvalue store.');
            break;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.