function FetchTest::testQueryFetchColIndexOutOfRange
Confirms that an out of range index in fetchCol() throws an error.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ FetchTest.php, line 227
Class
- FetchTest
- Tests the Database system's various fetch capabilities.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testQueryFetchColIndexOutOfRange() : void {
$this->expectException(\ValueError::class);
$this->expectExceptionMessage('Invalid column index');
$this->connection
->query('SELECT [name] FROM {test} WHERE [age] > :age', [
':age' => 25,
])
->fetchCol(200);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.