function SelectPagerDefaultTest::testHavingPagerQuery
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Database/SelectPagerDefaultTest.php \Drupal\Tests\system\Functional\Database\SelectPagerDefaultTest::testHavingPagerQuery()
- 10 core/modules/system/tests/src/Functional/Database/SelectPagerDefaultTest.php \Drupal\Tests\system\Functional\Database\SelectPagerDefaultTest::testHavingPagerQuery()
- 11.x core/modules/system/tests/src/Functional/Database/SelectPagerDefaultTest.php \Drupal\Tests\system\Functional\Database\SelectPagerDefaultTest::testHavingPagerQuery()
Confirms that a paging query results with a having expression are valid.
This is a regression test for #467984.
File
-
core/
modules/ system/ tests/ src/ Functional/ Database/ SelectPagerDefaultTest.php, line 119
Class
- SelectPagerDefaultTest
- Tests the pager query select extender.
Namespace
Drupal\Tests\system\Functional\DatabaseCode
public function testHavingPagerQuery() {
$query = Database::getConnection()->select('test', 't')
->extend(PagerSelectExtender::class);
$query->fields('t', [
'name',
])
->orderBy('name')
->groupBy('name')
->having('MAX([age]) > :count', [
':count' => 26,
])
->limit(5);
$ages = $query->execute()
->fetchCol();
$this->assertEquals([
'George',
'Ringo',
], $ages, 'Pager query with having expression returned the correct ages.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.