You are here

public function PagerTest::testRenderNullPager in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Plugin/PagerTest.php \Drupal\views\Tests\Plugin\PagerTest::testRenderNullPager()

Tests rendering with NULL pager.

File

core/modules/views/src/Tests/Plugin/PagerTest.php, line 270
Contains \Drupal\views\Tests\Plugin\PagerTest.

Class

PagerTest
Tests the pluggable pager system.

Namespace

Drupal\views\Tests\Plugin

Code

public function testRenderNullPager() {

  // Create 11 nodes and make sure that everyone is returned.
  // We create 11 nodes, because the default pager plugin had 10 items per page.
  $this
    ->drupalCreateContentType(array(
    'type' => 'page',
  ));
  for ($i = 0; $i < 11; $i++) {
    $this
      ->drupalCreateNode();
  }
  $view = Views::getView('test_pager_full');
  $this
    ->executeView($view);

  // Force the value again here.
  $view
    ->setAjaxEnabled(TRUE);
  $view->pager = NULL;
  $output = $view
    ->render();
  $output = \Drupal::service('renderer')
    ->renderRoot($output);
  $this
    ->assertEqual(preg_match('/<ul class="pager">/', $output), 0, 'The pager is not rendered.');
}