public function SelectComplexTest::testCountQueryDistinct in Drupal 8
Same name and namespace in other branches
- 9 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 270
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
->assertEqual($count, 6, 'Counted the correct number of records.');
}