You are here

protected function EntityReferenceRevisionsCompositeTest::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.

3 calls to EntityReferenceRevisionsCompositeTest::assertRevisionCount()
EntityReferenceRevisionsCompositeTest::testCompositeDeleteAfterChangingParent in tests/src/Kernel/EntityReferenceRevisionsCompositeTest.php
Tests the composite entity is not deleted when changing parents.
EntityReferenceRevisionsCompositeTest::testCompositeDeleteAfterDuplicatingParent in tests/src/Kernel/EntityReferenceRevisionsCompositeTest.php
Tests the composite entity is not deleted when duplicating host entity.
EntityReferenceRevisionsCompositeTest::testCompositeDeleteRevisionAfterChangingParent in tests/src/Kernel/EntityReferenceRevisionsCompositeTest.php
Composite entity with revisions isn't deleted when changing parents.

File

tests/src/Kernel/EntityReferenceRevisionsCompositeTest.php, line 675

Class

EntityReferenceRevisionsCompositeTest
Tests the entity_reference_revisions composite relationship.

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