1 views_pager.test public ViewsPagerTest::testNoLimit()

Tests the none-pager-query.

File

core/modules/views/tests/views_pager.test, line 110
Definition of ViewsPagerTest.

Class

ViewsPagerTest
Tests the pluggable pager system.

Code

public function testNoLimit() {
  // Create 11 nodes and make sure that everyone is returned.
  // We create 11 nodes, because the default pager plugin had 10 items per page.
  for ($i = 0; $i < 9; $i++) {
    $this->backdropCreateNode();
  }
  $view = $this->viewsPagerNoLimit();
  $view->set_display('default');
  $this->executeView($view);
  $this->assertEqual(count($view->result), 9, 'Make sure that every item is returned in the result');

  $view->destroy();

  // Setup and test a offset.
  $view = $this->viewsPagerNoLimit();
  $view->set_display('default');

  $pager = array(
    'type' => 'none',
    'options' => array(
      'offset' => 3,
    ),
  );
  $view->display_handler->set_option('pager', $pager);
  $this->executeView($view);

  $this->assertEqual(count($view->result), 6, 'Make sure that every item beside the first three is returned in the result');

  // Check some public functions.
  $this->assertFalse($view->query->pager->use_pager());
  $this->assertFalse($view->query->pager->use_count_query());
  $this->assertEqual($view->query->pager->get_items_per_page(), 0);
}