1 database_test.test | DatabaseSelectComplexTestCase::testDistinct() |
Test distinct queries.
File
- core/
modules/ simpletest/ tests/ database_test.test, line 2092 - Database tests.
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.');
}