protected function DatabaseBackendTest::getNumRows in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php \Drupal\KernelTests\Core\Cache\DatabaseBackendTest::getNumRows()
- 10 core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php \Drupal\KernelTests\Core\Cache\DatabaseBackendTest::getNumRows()
Gets the number of rows in the test cache bin database table.
Return value
int The number of rows in the test cache bin database table.
1 call to DatabaseBackendTest::getNumRows()
- DatabaseBackendTest::testGarbageCollection in core/tests/ Drupal/ KernelTests/ Core/ Cache/ DatabaseBackendTest.php 
- Tests the row count limiting of cache bin database tables.
File
- core/tests/ Drupal/ KernelTests/ Core/ Cache/ DatabaseBackendTest.php, line 98 
Class
- DatabaseBackendTest
- Unit test of the database backend using the generic cache unit test base.
Namespace
Drupal\KernelTests\Core\CacheCode
protected function getNumRows() {
  $table = 'cache_' . $this->testBin;
  $connection = $this->container
    ->get('database');
  $query = $connection
    ->select($table);
  $query
    ->addExpression('COUNT([cid])', 'cid');
  return (int) $query
    ->execute()
    ->fetchField();
}