function QueryGroupByTest::testGroupByCountOnlyFilters
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/QueryGroupByTest.php \Drupal\Tests\views\Kernel\QueryGroupByTest::testGroupByCountOnlyFilters()
- 8.9.x core/modules/views/tests/src/Kernel/QueryGroupByTest.php \Drupal\Tests\views\Kernel\QueryGroupByTest::testGroupByCountOnlyFilters()
- 10 core/modules/views/tests/src/Kernel/QueryGroupByTest.php \Drupal\Tests\views\Kernel\QueryGroupByTest::testGroupByCountOnlyFilters()
Tests groupby with filters.
File
-
core/
modules/ views/ tests/ src/ Kernel/ QueryGroupByTest.php, line 205
Class
- QueryGroupByTest
- Tests aggregate functionality of views, for example count.
Namespace
Drupal\Tests\views\KernelCode
public function testGroupByCountOnlyFilters() : void {
// Check if GROUP BY and HAVING are included when a view
// doesn't display SUM, COUNT, MAX, etc. functions in SELECT statement.
for ($x = 0; $x < 10; $x++) {
$this->storage
->create([
'name' => 'name1',
])
->save();
}
$view = Views::getView('test_group_by_in_filters');
$this->executeView($view);
$this->assertStringContainsString('GROUP BY', (string) $view->build_info['query'], 'Make sure that GROUP BY is in the query');
$this->assertStringContainsString('HAVING', (string) $view->build_info['query'], 'Make sure that HAVING is in the query');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.