$this->
assertEquals($expected,
$this->entityDefinitionUpdateManager->
getChangeSummary(), 'EntityDefinitionUpdateManager reports the expected change summary.'
);
// Run the update and ensure the new index is created.
$entity_type = \Drupal::
entityTypeManager()->
getDefinition('entity_test_update'
);
$original = \Drupal::
service('entity.last_installed_schema.repository'
)->
getLastInstalledDefinition('entity_test_update'
);
\Drupal::
service('entity_type.listener'
)->
onEntityTypeUpdate($entity_type,
$original);
$this->
assertTrue($this->database->
schema()->
indexExists('entity_test_update', 'entity_test_update__new_index'
), 'Index created.'
);
// Remove the index and ensure the update manager reports that as an
// update to the entity type.
$this->
removeEntityIndex();
$this->
assertTrue($this->entityDefinitionUpdateManager->
needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.'
);
$expected =
[ 'entity_test_update' =>
[ t('The %entity_type entity type needs to be updated.',
['%entity_type' =>
$this->entityTypeManager->
getDefinition('entity_test_update'
)->
getLabel()]),
],
];
$this->
assertEquals($expected,
$this->entityDefinitionUpdateManager->
getChangeSummary(), 'EntityDefinitionUpdateManager reports the expected change summary.'
);
// Run the update and ensure the index is deleted.
$entity_type = \Drupal::
entityTypeManager()->
getDefinition('entity_test_update'
);
$original = \Drupal::
service('entity.last_installed_schema.repository'
)->
getLastInstalledDefinition('entity_test_update'
);