Commit 5e5ef246 authored by alexpott's avatar alexpott

Issue #2828559 by amateescu, alexpott: More random fails in UpdatePathTestBase...

Issue #2828559 by amateescu, alexpott: More random fails in UpdatePathTestBase tests: "settings.cache failed with: missing schema"
parent 8a9f91ac
......@@ -74,7 +74,7 @@ function drupal_get_schema_versions($module) {
* module is not installed.
*/
function drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) {
static $versions = array();
$versions = &drupal_static(__FUNCTION__, array());
if ($reset) {
$versions = array();
......
......@@ -192,6 +192,8 @@ protected function setUp() {
$this->container = \Drupal::getContainer();
$this->replaceUser1();
require_once \Drupal::root() . '/core/includes/update.inc';
}
/**
......@@ -251,6 +253,28 @@ protected function runUpdates() {
if ($this->checkFailedUpdates) {
$this->assertNoRaw('<strong>' . t('Failed:') . '</strong>');
// 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 $update_name() update function from the $module module did not run.");
}
}
}
}
// Reset the static cache of drupal_get_installed_schema_version() so that
// more complex update path testing works.
drupal_static_reset('drupal_get_installed_schema_version');
// 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment