// and the update creates it.
$this->
addBaseFieldIndex();
$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 updated.',
strip_tags($changes['entity_test_update'
][0
]));
$this->
applyEntityUpdates();
$this->
assertTrue($this->database->
schema()->
indexExists('entity_test_update', 'entity_test_update_field__new_base_field'
), 'Index created.'
);
// Remove the above index, ensure the update manager reports it, and the
// update deletes it.
$this->
removeBaseFieldIndex();
$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 updated.',
strip_tags($changes['entity_test_update'
][0
]));
$this->
applyEntityUpdates();
$this->
assertFalse($this->database->
schema()->
indexExists('entity_test_update', 'entity_test_update_field__new_base_field'
), 'Index deleted.'
);
// Update the type of the base field from 'string' to 'text', ensure the
// update manager reports it, and the update adjusts the schema
// accordingly.
$this->
modifyBaseField();