diff -u b/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php b/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php --- b/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php @@ -36,8 +36,8 @@ // No pending updates should be available. $this->drupalGet('admin/reports/status'); - $requirement_value = $this->cssSelect("tr.system-status-report__entry th:contains('Entity/field definitions') + td"); - $this->assertEqual(t('Up to date'), trim((string) $requirement_value[0])); + $requirement_value = $this->cssSelect("tr.system-status-report__entry th:contains('Entity/field definitions')"); + $this->assertTrue(empty($requirement_value), 'There is no warning about Entity/field definitions'); // Enable content translation on entity types that have will have a // content_translation_uid. @@ -51,8 +51,14 @@ // No pending updates should be available. $this->drupalGet('admin/reports/status'); - $requirement_value = $this->cssSelect("tr.system-status-report__entry th:contains('Entity/field definitions') + td"); - $this->assertEqual(t('Up to date'), trim((string) $requirement_value[0])); + $requirement_value = $this->cssSelect("tr.system-status-report__entry th:contains('Entity/field definitions')"); + $this->assertTrue(empty($requirement_value), 'There is no warning about Entity/field definitions'); + + // The above tests for the absence of a warning are extremely fragile. + // Rebuild the container because we've installed modules through the UI. + drupal_flush_all_caches(); + $this->rebuildContainer(); + $this->assertFalse(\Drupal::entityDefinitionUpdateManager()->needsUpdates(), 'Entity and field schema data are correctly detected.'); } } reverted: --- b/core/modules/system/src/Tests/Entity/Update/UpdateApiEntityDefinitionUpdateTest.php +++ a/core/modules/system/src/Tests/Entity/Update/UpdateApiEntityDefinitionUpdateTest.php @@ -144,14 +144,14 @@ // Check that the status report initially displays no error. $this->drupalGet('admin/reports/status'); $this->assertNoRaw('Out of date'); + $this->assertNoRaw('Mismatch detected'); - $this->assertNoRaw('Mismatched entity and/or field definitions'); // Enable an entity update and check that we have a dedicated status report // item. $this->container->get('state')->set('entity_test.remove_name_field', TRUE); $this->drupalGet('admin/reports/status'); $this->assertNoRaw('Out of date'); + $this->assertRaw('Mismatch detected'); - $this->assertRaw('Mismatched entity and/or field definitions'); // Enable a db update and check that now the entity update status report // item is no longer displayed. We assume an update function will fix the @@ -159,13 +159,13 @@ $this->enableUpdates('entity_test', 'status_report', 8001); $this->drupalGet('admin/reports/status'); $this->assertRaw('Out of date'); + $this->assertNoRaw('Mismatch detected'); - $this->assertRaw('Mismatched entity and/or field definitions'); // Apply db updates and check that entity updates were not applied. $this->applyUpdates(); $this->drupalGet('admin/reports/status'); $this->assertNoRaw('Out of date'); + $this->assertRaw('Mismatch detected'); - $this->assertRaw('Mismatched entity and/or field definitions'); // Check that en exception would be triggered when trying to apply them with // existing data. @@ -181,7 +181,7 @@ // Check the status report is the same after trying to apply updates. $this->drupalGet('admin/reports/status'); $this->assertNoRaw('Out of date'); + $this->assertRaw('Mismatch detected'); - $this->assertRaw('Mismatched entity and/or field definitions'); // Delete entity data, enable a new update, run updates again and check that // entity updates were not applied even when no data exists. @@ -190,7 +190,7 @@ $this->applyUpdates(); $this->drupalGet('admin/reports/status'); $this->assertNoRaw('Out of date'); + $this->assertRaw('Mismatch detected'); - $this->assertRaw('Mismatched entity and/or field definitions'); } /** reverted: --- b/core/modules/system/system.install +++ a/core/modules/system/system.install @@ -641,15 +641,15 @@ $requirements['update']['description'] = t('Some modules have database schema updates to install. You should run the database update script immediately.', array(':update' => \Drupal::url('system.db_update'))); } + // Verify that no entity updates are pending after running every DB update. + if (!isset($requirements['update']['severity']) && \Drupal::entityDefinitionUpdateManager()->needsUpdates()) { + $requirements['entity_update'] = array( + 'title' => t('Entity/field definitions'), + 'value' => t('Mismatch detected'), + 'severity' => REQUIREMENT_ERROR, + // @todo Provide details: https://www.drupal.org/node/2554911 + 'description' => t('Mismatched entity and/or field definitions.'), + ); - $requirements['entity_update'] = [ - 'title' => t('Entity/field definitions'), - 'value' => t('Up to date'), - ]; - // Verify that no entity updates are pending. - if (\Drupal::entityDefinitionUpdateManager()->needsUpdates()) { - $requirements['entity_update']['severity'] = REQUIREMENT_ERROR; - // @todo Provide details: https://www.drupal.org/node/2554911 - $requirements['entity_update']['value'] = t('Mismatched entity and/or field definitions'); } }