diff --git a/core/modules/system/src/Tests/Entity/EntitySchemaTest.php b/core/modules/system/src/Tests/Entity/EntitySchemaTest.php index e7312bf..695c0e8 100644 --- a/core/modules/system/src/Tests/Entity/EntitySchemaTest.php +++ b/core/modules/system/src/Tests/Entity/EntitySchemaTest.php @@ -140,10 +140,11 @@ public function testModifyingTranslatableColumnSchema() { } /** - * Tests that after uninstalling a module the fields are removed from the - * schema. + * Tests fields from an uninstalled module are removed from the schema. */ public function testCleanUpStorageDefinition() { + // Find all the entity types provided by the entity_test module and install + // the schema for them. $entities = \Drupal::entityManager()->getDefinitions(); foreach ($entities as $name => $definition) { if ($definition->getProvider() == 'entity_test') { @@ -151,14 +152,16 @@ public function testCleanUpStorageDefinition() { }; } + // Uninstall the entity_test module. $this->container->get('module_installer')->uninstall(array('entity_test')); - // Ensure that all storage defintions have been removed from the schema. + // Get a list of all the entities in the schema. $key_value_store = \Drupal::keyValue('entity.storage_schema.sql'); $schema = $key_value_store->getAll(); $item_count = 0; + // Count the storage definitions that begin with entity_test. foreach (array_keys($schema) as $storage_definition_name) { $entity_item = substr($storage_definition_name, 0, strpos($storage_definition_name, '.')); if ($entity_item == 'entity_test') { @@ -166,8 +169,8 @@ public function testCleanUpStorageDefinition() { } } - $this->assertEqual($item_count, 0, 'After uninstallation the schema' . - 'still contains fields for the the comment entity.'); + // Ensure that all storage definitions have been removed from the schema. + $this->assertEqual($item_count, 0, 'After uninstalling entity_test module the schema still contains fields for the the entity_test entity.'); } }