You are here

protected function EntityReferenceRevisionsCompositeTranslatableFieldTest::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 EntityReferenceRevisionsCompositeTranslatableFieldTest::assertRevisionCount()
EntityReferenceRevisionsCompositeTranslatableFieldTest::testCompositePendingRevisionTranslation in tests/src/Kernel/EntityReferenceRevisionsCompositeTranslatableFieldTest.php
Test the storage for handling pending revisions with translations.

File

tests/src/Kernel/EntityReferenceRevisionsCompositeTranslatableFieldTest.php, line 340

Class

EntityReferenceRevisionsCompositeTranslatableFieldTest
Tests entity_reference_revisions composites with a translatable field.

Namespace

Drupal\Tests\entity_reference_revisions\Kernel

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);
}