Issue #2828559 by amateescu, alexpott: More random fails in UpdatePathTestBase tests: "settings.cache failed with: missing schema"

8.3.x
Alex Pott 2016-12-09 12:36:11 +00:00
parent 8a9f91ac16
commit 5e5ef2462d
2 changed files with 25 additions and 1 deletions

View File

@ -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();

View File

@ -192,6 +192,8 @@ abstract class UpdatePathTestBase extends WebTestBase {
$this->container = \Drupal::getContainer();
$this->replaceUser1();
require_once \Drupal::root() . '/core/includes/update.inc';
}
/**
@ -251,6 +253,28 @@ abstract class UpdatePathTestBase extends WebTestBase {
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.