function DatabaseSelectPagerDefaultTestCase::testHavingPagerQuery

Confirm that a paging query with a having expression returns valid results.

This is a regression test for #467984.

File

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

Class

DatabaseSelectPagerDefaultTestCase

Code

function testHavingPagerQuery() {
    $query = db_select('test', 't')->extend('PagerDefault');
    $query->fields('t', array(
        'name',
    ))
        ->orderBy('name')
        ->groupBy('name')
        ->having('MAX(age) > :count', array(
        ':count' => 26,
    ))
        ->limit(5);
    $ages = $query->execute()
        ->fetchCol();
    $this->assertEqual($ages, array(
        'George',
        'Ringo',
    ), 'Pager query with having expression returned the correct ages.');
}

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