Functionality tests for the pager example module.
Hierarchy
- PagerExampleTestCase extends DrupalWebTestCase
Functions & methods
| Name | Description |
|---|---|
| PagerExampleTestCase::getInfo | |
| PagerExampleTestCase::setUp | |
| PagerExampleTestCase::testPagerPage | Verify the functionality of the example module. |
File
- pager_example/
pager_example.test, line 11 - Simpletest case for pager_example module.
View source
class PagerExampleTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Pager Example',
'description' => 'Verify the pager functionality',
'group' => 'Examples',
);
}
function setUp() {
// Enable the module.
parent::setUp('pager_example');
}
/**
* Verify the functionality of the example module.
*/
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');
// lets 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');
}
}