function RevisionableContentEntityBaseTest::assertItemsTableCount

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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.

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.