You are here

protected function RevisionableContentEntityBaseTest::assertItemsTableCount in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php \Drupal\KernelTests\Core\Entity\RevisionableContentEntityBaseTest::assertItemsTableCount()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php \Drupal\KernelTests\Core\Entity\RevisionableContentEntityBaseTest::assertItemsTableCount()

Asserts the amount of items on entity related tables.

Parameters

int $count: The number of items expected to be in revisions related tables.

\Drupal\Core\Entity\EntityTypeInterface $definition: The definition and metadata of the entity being tested.

1 call to RevisionableContentEntityBaseTest::assertItemsTableCount()
RevisionableContentEntityBaseTest::testRevisionableContentEntity in core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php
Tests the correct functionality CRUD operations of entity revisions.

File

core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php, line 170

Class

RevisionableContentEntityBaseTest
Test the revision system.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function assertItemsTableCount($count, EntityTypeInterface $definition) {
  $connection = Database::getConnection();
  $this
    ->assertEquals(1, (int) $connection
    ->select($definition
    ->getBaseTable())
    ->countQuery()
    ->execute()
    ->fetchField());
  $this
    ->assertEquals(1, (int) $connection
    ->select($definition
    ->getDataTable())
    ->countQuery()
    ->execute()
    ->fetchField());
  $this
    ->assertEquals($count, (int) $connection
    ->select($definition
    ->getRevisionTable())
    ->countQuery()
    ->execute()
    ->fetchField());
  $this
    ->assertEquals($count, (int) $connection
    ->select($definition
    ->getRevisionDataTable())
    ->countQuery()
    ->execute()
    ->fetchField());
}