You are here

protected function ScheduledTransitionTest::getRevisionIds in Scheduled Transitions 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/ScheduledTransitionTest.php \Drupal\Tests\scheduled_transitions\Kernel\ScheduledTransitionTest::getRevisionIds()

Get revision IDs for an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An entity.

Return value

int[] Revision IDs.

4 calls to ScheduledTransitionTest::getRevisionIds()
ScheduledTransitionTest::testScheduledRevision in tests/src/Kernel/ScheduledTransitionTest.php
Tests a scheduled revision.
ScheduledTransitionTest::testScheduledRevisionLatestNonDefault in tests/src/Kernel/ScheduledTransitionTest.php
Tests a scheduled revision.
ScheduledTransitionTest::testScheduledRevisionRecreateDefaultHead in tests/src/Kernel/ScheduledTransitionTest.php
Tests a scheduled revision.
ScheduledTransitionTest::testScheduledRevisionRecreateNonDefaultHead in tests/src/Kernel/ScheduledTransitionTest.php
Tests a scheduled revision.

File

tests/src/Kernel/ScheduledTransitionTest.php, line 756

Class

ScheduledTransitionTest
Tests basic functionality of scheduled_transitions fields.

Namespace

Drupal\Tests\scheduled_transitions\Kernel

Code

protected function getRevisionIds(EntityInterface $entity) : array {
  $entityTypeId = $entity
    ->getEntityTypeId();
  $entityDefinition = \Drupal::entityTypeManager()
    ->getDefinition($entityTypeId);
  $entityStorage = \Drupal::entityTypeManager()
    ->getStorage($entityTypeId);

  /** @var int[] $ids */
  $ids = $entityStorage
    ->getQuery()
    ->allRevisions()
    ->condition($entityDefinition
    ->getKey('id'), $entity
    ->id())
    ->execute();
  return array_keys($ids);
}