You are here

protected function EntityReferenceRevisionsCompositeTranslationTest::assertAffectedRevisionCount in Entity Reference Revisions 8

Asserts the affected revision count of a certain entity.

Parameters

int $expected: The expected count.

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

2 calls to EntityReferenceRevisionsCompositeTranslationTest::assertAffectedRevisionCount()
EntityReferenceRevisionsCompositeTranslationTest::testCompositeTranslation in tests/src/Kernel/EntityReferenceRevisionsCompositeTranslationTest.php
Tests that composite translations affects the host entity's translations.
EntityReferenceRevisionsCompositeTranslationTest::testNestedCompositeTranslation in tests/src/Kernel/EntityReferenceRevisionsCompositeTranslationTest.php
Tests that nested composite translations affects the host translations.

File

tests/src/Kernel/EntityReferenceRevisionsCompositeTranslationTest.php, line 610

Class

EntityReferenceRevisionsCompositeTranslationTest
Tests the entity_reference_revisions composite relationship.

Namespace

Drupal\Tests\entity_reference_revisions\Kernel

Code

protected function assertAffectedRevisionCount($expected, EntityInterface $entity) {
  $entity_type = $entity
    ->getEntityType();
  $affected_revisions_count = $this->entityTypeManager
    ->getStorage($entity_type
    ->id())
    ->getQuery()
    ->condition($entity_type
    ->getKey('id'), $entity
    ->id())
    ->condition($entity_type
    ->getKey('langcode'), $entity
    ->language()
    ->getId())
    ->condition($entity_type
    ->getKey('revision_translation_affected'), 1)
    ->allRevisions()
    ->count()
    ->execute();
  $this
    ->assertEquals($expected, $affected_revisions_count);
}