diff --git a/core/lib/Drupal/Core/Field/FieldModuleUninstallValidator.php b/core/lib/Drupal/Core/Field/FieldModuleUninstallValidator.php index 9dc7c1f..b54579c 100644 --- a/core/lib/Drupal/Core/Field/FieldModuleUninstallValidator.php +++ b/core/lib/Drupal/Core/Field/FieldModuleUninstallValidator.php @@ -53,7 +53,7 @@ public function validate($module_name) { if ($storage_definition->getProvider() == $module_name) { $storage = $this->entityManager->getStorage($entity_type_id); if ($storage instanceof FieldableEntityStorageInterface && $storage->countFieldData($storage_definition, TRUE)) { - $reasons[] = $this->t('There is content for the field @field-name on entity type @entity_type.', array( + $reasons[] = $this->t('There is data for the field @field-name on entity type @entity_type.', array( '@field-name' => $storage_definition->getName(), '@entity_type' => $entity_type->getLabel(), )); diff --git a/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php b/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php index d9feabc..f427ade 100644 --- a/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php +++ b/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php @@ -40,7 +40,6 @@ protected function setUp() { ->setTargetEntityTypeId('entity_test') ->setTargetBundle('entity_test'); $this->state->set('entity_test.additional_base_field_definitions', $definitions); - // @todo: Use better field definition classes once there are any. $definitions['extra_bundle_field'] = FieldStorageDefinition::create('string') ->setName('extra_bundle_field') ->setTargetEntityTypeId('entity_test') @@ -78,11 +77,13 @@ public function testUninstallingModule() { $entity->save(); try { + $message = 'Module uninstallation fails as the module provides a base field which has content.'; $this->getModuleInstaller()->uninstall(array('entity_test_extra')); - $this->fail('Module uninstallation fails as the module provides a base field which has content.'); + $this->fail($message); } catch (ModuleUninstallValidatorException $e) { - $this->pass('Module uninstallation fails as the module provides a base field which has content.'); + $this->pass($message); + $this->assertEqual($e->getMessage(), 'The following reasons prevents the modules from being uninstalled: There is data for the field extra_base_field on entity type Test entity.'); } // Verify uninstalling entity_test is not possible when there is content for