function SelectComplexTest::testCountQueryDistinct
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testCountQueryDistinct()
- 10 core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testCountQueryDistinct()
- 11.x core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testCountQueryDistinct()
Tests that we can generate a count query from a query with distinct.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ SelectComplexTest.php, line 280
Class
- SelectComplexTest
- Tests the Select query builder with more complex queries.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testCountQueryDistinct() {
$query = $this->connection
->select('test_task');
$query->addField('test_task', 'task');
$query->distinct();
$count = $query->countQuery()
->execute()
->fetchField();
$this->assertEquals(6, $count, 'Counted the correct number of records.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.