You are here

public function FetchTest::testRowCount in Zircon Profile 8

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

Tests that rowCount() throws exception on SELECT query.

File

core/modules/system/src/Tests/Database/FetchTest.php, line 138
Contains \Drupal\system\Tests\Database\FetchTest.

Class

FetchTest
Tests the Database system's various fetch capabilities.

Namespace

Drupal\system\Tests\Database

Code

public function testRowCount() {
  $result = db_query('SELECT name FROM {test}');
  try {
    $result
      ->rowCount();
    $exception = FALSE;
  } catch (RowCountException $e) {
    $exception = TRUE;
  }
  $this
    ->assertTrue($exception, 'Exception was thrown');
}