function PagerFunctionalWebTestCase::testActiveClass

Tests markup and CSS classes of pager links.

File

modules/simpletest/tests/pager.test, line 40

Class

PagerFunctionalWebTestCase
Tests pager functionality.

Code

function testActiveClass() {
    // Verify first page.
    $this->drupalGet('admin/reports/dblog');
    $current_page = 0;
    $this->assertPagerItems($current_page);
    // Verify any page but first/last.
    $current_page++;
    $this->drupalGet('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->drupalGet($GLOBALS['base_root'] . $elements[0]['href'], array(
        'external' => TRUE,
    ));
    $this->assertPagerItems($current_page);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.