1 database_test.test DatabaseSelectComplexTestCase::testCountQueryDistinct()

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

File

core/modules/simpletest/tests/database_test.test, line 2149
Database tests.

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