7.x database_test.test DatabaseSelectPagerDefaultTestCase::testInnerPagerQuery()

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

This is a regression test for #467984.

File

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

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,
  ), 'Inner pager query returned the correct ages.');
}