You are here

public function TemporaryQueryTest::countTableRows in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php \Drupal\Tests\system\Functional\Database\TemporaryQueryTest::countTableRows()

Returns the number of rows of a table.

1 call to TemporaryQueryTest::countTableRows()
TemporaryQueryTest::testTemporaryQuery in core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php
Confirms that temporary tables work and are limited to one request.

File

core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php, line 27

Class

TemporaryQueryTest
Tests the temporary query functionality.

Namespace

Drupal\Tests\system\Functional\Database

Code

public function countTableRows($table_name) {
  return Database::getConnection()
    ->select($table_name)
    ->countQuery()
    ->execute()
    ->fetchField();
}