You are here

function DatabaseSelectPagerDefaultTestCase::testHavingPagerQuery in Drupal 7

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 2489

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.');
}