1 pager.test PagerFunctionalWebTestCase::testActiveClass()

Tests markup and CSS classes of pager links.

File

core/modules/simpletest/tests/pager.test, line 35
Tests for pager functionality.

Class

PagerFunctionalWebTestCase
Tests pager functionality.

Code

function testActiveClass() {
  // Verify first page.
  $this->backdropGet('admin/reports/dblog');
  $current_page = 0;
  $this->assertPagerItems($current_page);

  // Verify any page but first/last.
  $current_page++;
  $this->backdropGet('admin/reports/dblog', array('query' => array('page' => $current_page)));
  $this->assertPagerItems($current_page);

  // Verify last page.
  $elements = $this->xpath('//li[contains(@class, :class)]/a', array(':class' => 'pager-last'));
  preg_match('@page=(\d+)@', $elements[0]['href'], $matches);
  $current_page = (int) $matches[1];
  $this->backdropGet($GLOBALS['base_root'] . $elements[0]['href'], array('external' => TRUE));
  $this->assertPagerItems($current_page);
}