$summary[$entity_type_id][]=$this->t('The %field_name field needs to be installed.',['%field_name'=>$storage_definitions[$field_name]->getLabel()]);
$summary[$entity_type_id][]=$this->t('The %field_name field needs to be installed.',['%field_name'=>$storage_definitions[$field_name]->getLabel()?:$field_name]);
break;
casestatic::DEFINITION_UPDATED:
$summary[$entity_type_id][]=$this->t('The %field_name field needs to be updated.',['%field_name'=>$storage_definitions[$field_name]->getLabel()]);
$summary[$entity_type_id][]=$this->t('The %field_name field needs to be updated.',['%field_name'=>$storage_definitions[$field_name]->getLabel()?:$field_name]);
break;
casestatic::DEFINITION_DELETED:
$summary[$entity_type_id][]=$this->t('The %field_name field needs to be uninstalled.',['%field_name'=>$original_storage_definitions[$field_name]->getLabel()]);
$summary[$entity_type_id][]=$this->t('The %field_name field needs to be uninstalled.',['%field_name'=>$original_storage_definitions[$field_name]->getLabel()?:$field_name]);
$this->assertEquals('The A new base field field needs to be updated.',strip_tags($changes['entity_test_update'][0]));
$this->applyEntityUpdates();
$this->assertFalse($this->database->schema()->fieldExists('entity_test_update','new_base_field'),'Original column deleted in shared table for new_base_field.');
$this->assertTrue($this->database->schema()->fieldExists('entity_test_update','new_base_field__value'),'Value column created in shared table for new_base_field.');
@@ -310,17 +298,44 @@ public function testBaseFieldCreateUpdateDeleteWithoutData() {
// update deletes the schema.
$this->removeBaseField();
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(),'EntityDefinitionUpdateManager reports that updates are needed.');
$expected=[
'entity_test_update'=>[
t('The %field_name field needs to be uninstalled.',['%field_name'=>t('A new base field')]),
],
];
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(),$expected,'EntityDefinitionUpdateManager reports the expected change summary.');
$this->assertEquals('The A new base field field needs to be uninstalled.',strip_tags($changes['entity_test_update'][0]));
$this->applyEntityUpdates();
$this->assertFalse($this->database->schema()->fieldExists('entity_test_update','new_base_field_value'),'Value column deleted from shared table for new_base_field.');
$this->assertFalse($this->database->schema()->fieldExists('entity_test_update','new_base_field_format'),'Format column deleted from shared table for new_base_field.');
}
/**
* Tests creating, updating, and deleting a base field with no label set
*
* See testBaseFieldCreateUpdateDeleteWithoutData() for more details
$this->assertEquals('The A new bundle field field needs to be updated.',strip_tags($changes['entity_test_update'][0]));
$this->applyEntityUpdates();
$this->assertTrue($this->database->schema()->fieldExists('entity_test_update__new_bundle_field','new_bundle_field_format'),'Format column created in dedicated table for new_base_field.');
@@ -356,12 +365,9 @@ public function testBundleFieldCreateUpdateDeleteWithoutData() {
// update deletes the schema.
$this->removeBundleField();
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(),'EntityDefinitionUpdateManager reports that updates are needed.');
$expected=[
'entity_test_update'=>[
t('The %field_name field needs to be uninstalled.',['%field_name'=>t('A new bundle field')]),
],
];
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(),$expected,'EntityDefinitionUpdateManager reports the expected change summary.');