protected function ContentEntityUpdateParagraphTest::assertRevisionCount

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 ContentEntityUpdateParagraphTest::assertRevisionCount()
ContentEntityUpdateParagraphTest::testUpdateParagraphTranslation in sources/content/tests/src/Kernel/ContentEntityUpdateParagraphTest.php
Tests that paragraph items with existing translations gets new translation.

File

sources/content/tests/src/Kernel/ContentEntityUpdateParagraphTest.php, line 212

Class

ContentEntityUpdateParagraphTest
Content entity update paragraphs test.

Namespace

Drupal\Tests\tmgmt_content\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)
    ->accessCheck(FALSE)
    ->condition($id_field, $entity_id)
    ->allRevisions()
    ->count()
    ->execute();
  $this
    ->assertEquals($expected, $revision_count);
}