You are here

function SelectComplexTest::testSelectWithRowCount in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Database/SelectComplexTest.php \Drupal\system\Tests\Database\SelectComplexTest::testSelectWithRowCount()

Tests that rowCount() throws exception on SELECT query.

File

core/modules/system/src/Tests/Database/SelectComplexTest.php, line 368
Contains \Drupal\system\Tests\Database\SelectComplexTest.

Class

SelectComplexTest
Tests the Select query builder with more complex queries.

Namespace

Drupal\system\Tests\Database

Code

function testSelectWithRowCount() {
  $query = db_select('test');
  $query
    ->addField('test', 'name');
  $result = $query
    ->execute();
  try {
    $result
      ->rowCount();
    $exception = FALSE;
  } catch (RowCountException $e) {
    $exception = TRUE;
  }
  $this
    ->assertTrue($exception, 'Exception was thrown');
}