You are here

public function PagerExampleTestCase::testPagerPage in Examples for Developers 7

Verify the functionality of the example module.

File

pager_example/pager_example.test, line 36
Simpletest case for pager_example module.

Class

PagerExampleTestCase
Functionality tests for the pager example module.

Code

public function testPagerPage() {

  // No need to login for this test.
  $this
    ->drupalGet('examples/pager_example');
  $this
    ->assertText('next', 'Found next link');
  $this
    ->assertText('last', 'Found last link');

  // On the first page we shouldn't see the first
  // or previous links.
  $this
    ->assertNoText('first', 'No first link on the first page');
  $this
    ->assertNoText('previous', 'No previous link on the first page');

  // Let's go to the second page.
  $this
    ->drupalGet('examples/pager_example', array(
    'query' => array(
      'page' => 1,
    ),
  ));
  $this
    ->assertText('next', 'Found next link');
  $this
    ->assertText('last', 'Found last link');

  // On the second page we should also see the first
  // and previous links.
  $this
    ->assertText('first', 'Found first link');
  $this
    ->assertText('previous', 'Found previous link');
}