function FetchTest::testLegacyFetchColumn
Confirms deprecation of StatementPrefetchIterator::fetchColumn().
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ FetchTest.php, line 394
Class
- FetchTest
- Tests the Database system's various fetch capabilities.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testLegacyFetchColumn() : void {
$statement = $this->connection
->query('SELECT [name] FROM {test} WHERE [age] = :age', [
':age' => 25,
]);
if (!$statement instanceof StatementPrefetchIterator) {
$this->markTestSkipped('This test is for StatementPrefetchIterator statements only.');
}
$this->expectDeprecation('Drupal\\Core\\Database\\StatementPrefetchIterator::fetchColumn() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use ::fetchField() instead. See https://www.drupal.org/node/3490312');
$statement->fetchColumn();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.