function InstallTest::testUninstallPostUpdateFunctions

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Module/InstallTest.php \Drupal\Tests\system\Functional\Module\InstallTest::testUninstallPostUpdateFunctions()
  2. 10 core/modules/system/tests/src/Kernel/Module/InstallTest.php \Drupal\Tests\system\Kernel\Module\InstallTest::testUninstallPostUpdateFunctions()
  3. 11.x core/modules/system/tests/src/Kernel/Module/InstallTest.php \Drupal\Tests\system\Kernel\Module\InstallTest::testUninstallPostUpdateFunctions()

Ensures that post update functions are removed on uninstall.

File

core/modules/system/tests/src/Functional/Module/InstallTest.php, line 69

Class

InstallTest
Tests the installation of modules.

Namespace

Drupal\Tests\system\Functional\Module

Code

public function testUninstallPostUpdateFunctions() {
    \Drupal::service('module_installer')->uninstall([
        'module_test',
    ]);
    $post_update_key_value = \Drupal::keyValue('post_update');
    $existing_updates = $post_update_key_value->get('existing_updates', []);
    $this->assertNotContains('module_test_post_update_test', $existing_updates);
}

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