function DatabaseSelectComplexTestCase::testHavingCountQuery

File

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

Class

DatabaseSelectComplexTestCase
Test more complex select statements.

Code

function testHavingCountQuery() {
    $query = db_select('test')->extend('PagerDefault')
        ->groupBy('age')
        ->having('age + 1 > 0');
    $query->addField('test', 'age');
    $query->addExpression('age + 1');
    $count = count($query->execute()
        ->fetchCol());
    $this->assertEqual($count, 4, 'Counted the correct number of records.');
}

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