You are here

function DatabaseSelectComplexTestCase::testDistinct in Drupal 7

Test distinct queries.

File

modules/simpletest/tests/database_test.test, line 2158

Class

DatabaseSelectComplexTestCase
Test more complex select statements.

Code

function testDistinct() {
  $query = db_select('test_task');
  $task_field = $query
    ->addField('test_task', 'task');
  $query
    ->distinct();
  $result = $query
    ->execute();
  $num_records = 0;
  foreach ($result as $record) {
    $num_records++;
  }
  $this
    ->assertEqual($num_records, 6, 'Returned the correct number of rows.');
}