$entity =
$storage->
load($entity_id);
// Confirm current revision loads the correct data.
// Number of values per field loaded equals the field cardinality.
$this->
assertCount($cardinality,
$entity->
{$this->fieldTestData->field_name
}, 'Current revision: expected number of values'
);
for ($delta = 0;
$delta <
$cardinality;
$delta++
) { // The field value loaded matches the one inserted or updated.
$this->
assertEquals($values[$current_revision][$delta]['value'
],
$entity->
{$this->fieldTestData->field_name
}[$delta]->value,
new FormattableMarkup('Current revision: expected value %delta was found.',
['%delta' =>
$delta]));
} // Confirm each revision loads the correct data.
foreach (array_keys($values) as $revision_id) { $entity =
$storage->
loadRevision($revision_id);
// Number of values per field loaded equals the field cardinality.
$this->
assertCount($cardinality,
$entity->
{$this->fieldTestData->field_name
},
new FormattableMarkup('Revision %revision_id: expected number of values.',
['%revision_id' =>
$revision_id]));
for ($delta = 0;
$delta <
$cardinality;
$delta++
) { // The field value loaded matches the one inserted or updated.
$this->
assertEquals($values[$revision_id][$delta]['value'
],
$entity->
{$this->fieldTestData->field_name
}[$delta]->value,
new FormattableMarkup('Revision %revision_id: expected value %delta was found.',
['%revision_id' =>
$revision_id, '%delta' =>
$delta]));
} } } /**
* Tests the 'multiple' load feature.
*/