function InstallUninstallTest::assertInstallModuleUpdates
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php \Drupal\Tests\system\Functional\Module\InstallUninstallTest::assertInstallModuleUpdates()
Asserts the module post update functions after install.
Parameters
string $module: The module that got installed.
1 call to InstallUninstallTest::assertInstallModuleUpdates()
- InstallUninstallTest::testInstallUninstall in core/
modules/ system/ tests/ src/ Functional/ Module/ InstallUninstallTest.php - Tests that a fixed set of modules can be installed and uninstalled.
File
-
core/
modules/ system/ tests/ src/ Functional/ Module/ InstallUninstallTest.php, line 291
Class
- InstallUninstallTest
- Install/uninstall core module and confirm table creation/deletion.
Namespace
Drupal\Tests\system\Functional\ModuleCode
protected function assertInstallModuleUpdates($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();
$empty_result = TRUE;
foreach ($all_update_functions as $function) {
list($function_module, ) = explode('_post_update_', $function);
if ($module === $function_module) {
$empty_result = FALSE;
break;
}
}
$this->assertTrue($empty_result, 'Ensures that no pending post update functions are available.');
$existing_updates = \Drupal::keyValue('post_update')->get('existing_updates', []);
switch ($module) {
case 'block':
$this->assertEmpty(array_diff([
'block_post_update_disable_blocks_with_missing_contexts',
], $existing_updates));
break;
case 'update_test_postupdate':
$expected = [
'update_test_postupdate_post_update_first',
'update_test_postupdate_post_update_second',
'update_test_postupdate_post_update_test1',
'update_test_postupdate_post_update_test0',
'update_test_postupdate_post_update_foo',
'update_test_postupdate_post_update_bar',
'update_test_postupdate_post_update_baz',
];
$this->assertSame($expected, $existing_updates);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.