You are here

protected function RevisionableContentEntityBaseTest::assertItemsTableCount in Drupal 8

Same name and namespace in other branches
  1. 9 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 179

Class

RevisionableContentEntityBaseTest
Test the revision system.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function assertItemsTableCount($count, EntityTypeInterface $definition) {
  $connection = Database::getConnection();
  $this
    ->assertEqual(1, $connection
    ->query('SELECT COUNT(*) FROM {' . $definition
    ->getBaseTable() . '}')
    ->fetchField());
  $this
    ->assertEqual(1, $connection
    ->query('SELECT COUNT(*) FROM {' . $definition
    ->getDataTable() . '}')
    ->fetchField());
  $this
    ->assertEqual($count, $connection
    ->query('SELECT COUNT(*) FROM {' . $definition
    ->getRevisionTable() . '}')
    ->fetchField());
  $this
    ->assertEqual($count, $connection
    ->query('SELECT COUNT(*) FROM {' . $definition
    ->getRevisionDataTable() . '}')
    ->fetchField());
}