You are here

protected function ContentGenerationTrait::getRevisions in Workbench Moderation to Content Moderation 8.2

1 call to ContentGenerationTrait::getRevisions()
ContentGenerationTrait::getRevisionMatrix in tests/src/Kernel/ContentGenerationTrait.php

File

tests/src/Kernel/ContentGenerationTrait.php, line 47

Class

ContentGenerationTrait

Namespace

Drupal\Tests\wbm2cm\Kernel

Code

protected function getRevisions(ContentEntityInterface $entity) {
  $entity_id = $entity
    ->id();
  $entity_type = $entity
    ->getEntityType();
  $revisions = $this
    ->query($entity_type
    ->id())
    ->allRevisions()
    ->condition($entity_type
    ->getKey('id'), $entity_id)
    ->execute();
  $this->storage
    ->resetCache([
    $entity_id,
  ]);
  foreach (array_keys($revisions) as $vid) {
    (yield $vid => $this->storage
      ->loadRevision($vid));
  }
}