You are here

protected function EntityReferenceRevisionsOrphanRemovalTest::assertRevisionCount in Entity Reference Revisions 8

Asserts the revision count of a certain entity.

Parameters

int $expected: The expected count.

string $entity_type_id: The entity type ID, e.g. node.

int $entity_id: The entity ID.

1 call to EntityReferenceRevisionsOrphanRemovalTest::assertRevisionCount()
EntityReferenceRevisionsOrphanRemovalTest::testNotUsedRevisionDeletion in tests/src/Functional/EntityReferenceRevisionsOrphanRemovalTest.php
Tests that revisions that are no longer used are properly deleted.

File

tests/src/Functional/EntityReferenceRevisionsOrphanRemovalTest.php, line 138

Class

EntityReferenceRevisionsOrphanRemovalTest
Tests orphan composite revisions are properly removed.

Namespace

Drupal\Tests\entity_reference_revisions\Functional

Code

protected function assertRevisionCount($expected, $entity_type_id, $entity_id) {
  $id_field = \Drupal::entityTypeManager()
    ->getDefinition($entity_type_id)
    ->getKey('id');
  $revision_count = \Drupal::entityQuery($entity_type_id)
    ->condition($id_field, $entity_id)
    ->allRevisions()
    ->count()
    ->execute();
  $this
    ->assertEquals($expected, $revision_count);
}