function FetchTest::testQueryFetchColIndexOutOfRangeOnEmptyResultSet

Confirms empty result set prevails on out of range index in fetchCol().

File

core/tests/Drupal/KernelTests/Core/Database/FetchTest.php, line 238

Class

FetchTest
Tests the Database system's various fetch capabilities.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testQueryFetchColIndexOutOfRangeOnEmptyResultSet() : void {
    $this->assertSame([], $this->connection
        ->query('SELECT [name] FROM {test} WHERE [age] = :age', [
        ':age' => 255,
    ])
        ->fetchCol(200));
}

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