// revisionable entity.
$entity_type_id = 'entity_test_rev';
$storage =
$this->entityTypeManager->
getStorage($entity_type_id);
$values =
['name' =>
$this->
randomString()];
$entity =
$storage->
create($values);
$storage->
save($entity);
/** @var \Drupal\Core\Entity\ContentEntityInterface $revision */
$revision =
$storage->
createRevision($entity, FALSE
);
$revision->
save();
$active =
$this->entityRepository->
getActive($entity_type_id,
$entity->
id(),
$en_contexts);
$this->
assertEntityType($active,
$entity_type_id);
$this->
assertSame($revision->
getLoadedRevisionId(),
$active->
getLoadedRevisionId());
/** @var \Drupal\Core\Entity\ContentEntityInterface $revision2 */
$revision2 =
$storage->
createRevision($revision);
$revision2->
save();
$active =
$this->entityRepository->
getActive($entity_type_id,
$entity->
id(),
$en_contexts);
$this->
assertSame($revision2->
getLoadedRevisionId(),
$active->
getLoadedRevisionId());
// Check that the correct active variant is returned for a translatable
// non-revisionable entity.
$entity_type_id = 'entity_test_mul';