function DatabaseSelectComplexTestCase::testDistinct

Test distinct queries.

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.