You are here

function DatabaseSelectComplexTestCase::testDistinct in SimpleTest 7

Test distinct queries.

File

tests/database_test.test, line 1801

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, t('Returned the correct number of rows.'));
}