function DatabaseSelectComplexTestCase::testCountQueryDistinct

Test that we can generate a count query from a query with distinct.

File

drupal/modules/simpletest/tests/database_test.test, line 2247

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.');
}