diff --git a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php index 7eb5c10..cd90421 100644 --- a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php +++ b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php @@ -146,6 +146,8 @@ function __construct($test_id = NULL) { * container that would normally be done via the installer. */ protected function setUp() { + require_once \Drupal::root() . '/core/includes/update.inc'; + $this->runDbTasks(); // Allow classes to set database dump files. $this->setDatabaseDumpFiles(); @@ -251,6 +253,25 @@ protected function runUpdates() { if ($this->checkFailedUpdates) { $this->assertNoRaw('' . t('Failed:') . ''); + // Ensure that there are no pending updates. + foreach (['update', 'post_update'] as $update_type) { + switch ($update_type) { + case 'update': + $all_updates = update_get_update_list(); + break; + case 'post_update': + $all_updates = \Drupal::service('update.post_update_registry')->getPendingUpdateInformation(); + break; + } + foreach ($all_updates as $module => $updates) { + if (!empty($updates['pending'])) { + foreach (array_keys($updates['pending']) as $update_name) { + $this->fail("The $module : $update_name update function did not run."); + } + } + } + } + // The config schema can be incorrect while the update functions are being // executed. But once the update has been completed, it needs to be valid // again. Assert the schema of all configuration objects now.