$this->
assertTrue($this->database->
schema()->
tableExists('entity_test_update'
), 'Base table for entity_test_update exists before uninstalling it.'
);
$this->entityDefinitionUpdateManager->
uninstallEntityType($entity_type);
$this->
assertFalse($this->database->
schema()->
tableExists('entity_test_update'
), 'Base table for entity_test_update does not exist anymore.'
);
} /**
* Tests creating, updating, and deleting a base field if no entities exist.
*/
public function testBaseFieldCreateUpdateDeleteWithoutData() { // Add a base field, ensure the update manager reports it, and the update
// creates its schema.
$this->
addBaseField();
$this->
assertTrue($this->entityDefinitionUpdateManager->
needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.'
);
$changes =
$this->entityDefinitionUpdateManager->
getChangeSummary();
$this->
assertCount(1,
$changes['entity_test_update'
]);
$this->
assertEquals('The A new base field field needs to be installed.',
strip_tags($changes['entity_test_update'
][0
]));
$this->
applyEntityUpdates();
$this->
assertTrue($this->database->
schema()->
fieldExists('entity_test_update', 'new_base_field'
), 'Column created in shared table for new_base_field.'
);
// Add an index on the base field, ensure the update manager reports it,
// and the update creates it.
$this->
addBaseFieldIndex();
$this->
assertTrue($this->entityDefinitionUpdateManager->
needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.'
);