You are here

function DatabaseSelectPagerDefaultTestCase::testInnerPagerQuery in SimpleTest 7

Confirm that a pager query with inner pager query returns valid results.

This is a regression test for #467984.

File

tests/database_test.test, line 1936

Class

DatabaseSelectPagerDefaultTestCase

Code

function testInnerPagerQuery() {
  $query = db_select('test', 't')
    ->extend('PagerDefault');
  $query
    ->fields('t', array(
    'age',
  ))
    ->orderBy('age')
    ->limit(5);
  $outer_query = db_select($query);
  $outer_query
    ->addField('subquery', 'age');
  $ages = $outer_query
    ->execute()
    ->fetchCol();
  $this
    ->assertEqual($ages, array(
    25,
    26,
    27,
    28,
  ), t('Inner pager query returned the correct ages.'));
}