diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-09-09 23:18:30 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-09-09 23:18:30 +0000 |
commit | ccd6fb62a3a9b5da77bdd2fcaecdf6be2734b1bf (patch) | |
tree | c30e2f902475a130e28d1c7ad8ed25602ee7a13d /modules/simpletest/tests/database_test.test | |
parent | eaee909a00a516d864da65e44f8abe5446914c7e (diff) | |
download | brdo-ccd6fb62a3a9b5da77bdd2fcaecdf6be2734b1bf.tar.gz brdo-ccd6fb62a3a9b5da77bdd2fcaecdf6be2734b1bf.tar.bz2 |
#903110 by bojanz: Fixed Multiple pager support is partially broken. (with tests)
Diffstat (limited to 'modules/simpletest/tests/database_test.test')
-rw-r--r-- | modules/simpletest/tests/database_test.test | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test index 16199c345..10afff465 100644 --- a/modules/simpletest/tests/database_test.test +++ b/modules/simpletest/tests/database_test.test @@ -2216,6 +2216,43 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase { ->fetchCol(); $this->assertEqual($ages, array('George', 'Ringo'), t('Pager query with having expression returned the correct ages.')); } + + /** + * Confirm that every pager gets a valid non-overlaping element ID. + */ + function testElementNumbers() { + $_GET['page'] = '3, 2, 1, 0'; + + $name = db_select('test', 't')->extend('PagerDefault') + ->element(2) + ->fields('t', array('name')) + ->orderBy('age') + ->limit(1) + ->execute() + ->fetchField(); + $this->assertEqual($name, 'Paul', t('Pager query #1 with a specified element ID returned the correct results.')); + + // Setting an element smaller than the previous one + // should not overwrite the pager $maxElement with a smaller value. + $name = db_select('test', 't')->extend('PagerDefault') + ->element(1) + ->fields('t', array('name')) + ->orderBy('age') + ->limit(1) + ->execute() + ->fetchField(); + $this->assertEqual($name, 'George', t('Pager query #2 with a specified element ID returned the correct results.')); + + $name = db_select('test', 't')->extend('PagerDefault') + ->fields('t', array('name')) + ->orderBy('age') + ->limit(1) + ->execute() + ->fetchField(); + $this->assertEqual($name, 'John', t('Pager query #3 with a generated element ID returned the correct results.')); + + unset($_GET['page']); + } } |