You are here

function DatabaseSelectPagerDefaultTestCase::testHavingPagerQuery in SimpleTest 7

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

This is a regression test for #467984.

File

tests/database_test.test, line 1957

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',
  ), t('Pager query with having expression returned the correct ages.'));
}