function DatabaseSelectComplexTestCase::testCountQueryDistinct in Drupal 7
Test that we can generate a count query from a query with distinct.
File
- modules/
simpletest/ tests/ database_test.test, line 2253
Class
- DatabaseSelectComplexTestCase
- Test more complex select statements.
Code
function testCountQueryDistinct() {
$query = db_select('test_task');
$task_field = $query
->addField('test_task', 'task');
$query
->distinct();
$count = $query
->countQuery()
->execute()
->fetchField();
$this
->assertEqual($count, 6, 'Counted the correct number of records.');
}