$vids[] =
$entity->
getRevisionId();
$controller =
$this->container->
get('entity_type.manager'
)->
getStorage($entity->
getEntityTypeId());
$controller->
resetCache();
// Confirm each revision loads
foreach ($vids as $vid) { $revision =
$controller->
loadRevision($vid);
$this->
assertCount($cardinality,
$revision->
{$this->fieldTestData->field_name
}, "The test entity revision
$vid has
$cardinality values."
);
} // Delete revision 1, confirm the other two still load.
$controller->
deleteRevision($vids[1
]);
$controller->
resetCache();
foreach ([0, 2
] as $key) { $vid =
$vids[$key];
$revision =
$controller->
loadRevision($vid);
$this->
assertCount($cardinality,
$revision->
{$this->fieldTestData->field_name
}, "The test entity revision
$vid has
$cardinality values."
);
} // Confirm the current revision still loads
$controller->
resetCache();
$current =
$controller->
load($entity->
id());
$this->
assertCount($cardinality,
$current->
{$this->fieldTestData->field_name
}, "The test entity current revision has
$cardinality values."
);