function TemporaryQueryTestBase::countTableRows

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Database/TemporaryQueryTestBase.php \Drupal\KernelTests\Core\Database\TemporaryQueryTestBase::countTableRows()

Returns the number of rows of a table.

1 call to TemporaryQueryTestBase::countTableRows()
TemporaryQueryTestBase::testTemporaryQuery in core/tests/Drupal/KernelTests/Core/Database/TemporaryQueryTestBase.php
Confirms that temporary tables work.

File

core/tests/Drupal/KernelTests/Core/Database/TemporaryQueryTestBase.php, line 26

Class

TemporaryQueryTestBase
Tests the temporary query functionality.

Namespace

Drupal\KernelTests\Core\Database

Code

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

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