summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-12-09 12:36:11 (GMT)
committerAlex Pott2016-12-09 12:36:11 (GMT)
commit5e5ef2462ddbc0e1126e8796d668adf408aa45e8 (patch)
tree2b0213ba82c9ac12aaeff86ab87c2c85a250ce9a
parent8a9f91ac16a1bde490574ec8838ffc66516d7eb9 (diff)
Issue #2828559 by amateescu, alexpott: More random fails in UpdatePathTestBase tests: "settings.cache failed with: missing schema"
-rw-r--r--core/includes/schema.inc2
-rw-r--r--core/modules/system/src/Tests/Update/UpdatePathTestBase.php24
2 files changed, 25 insertions, 1 deletions
diff --git a/core/includes/schema.inc b/core/includes/schema.inc
index 4712d3b..aa3984b 100644
--- a/core/includes/schema.inc
+++ b/core/includes/schema.inc
@@ -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();
diff --git a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
index 7eb5c10..702fdb2 100644
--- a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
+++ b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
@@ -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.