You are here

protected function RevisionableContentEntityBaseTest::assertItemsTableCount in Drupal 10

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

Asserts the amount of items on entity related tables.

@internal

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.

File

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

Class

RevisionableContentEntityBaseTest
Test the revision system.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function assertItemsTableCount(int $count, EntityTypeInterface $definition) : void {
  $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());
}