pager_example.test 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @file
  4. * Simpletest case for pager_example module.
  5. */
  6. /**
  7. * Functionality tests for the pager example module.
  8. *
  9. * @ingroup pager_example
  10. */
  11. class PagerExampleTestCase extends DrupalWebTestCase {
  12. /**
  13. * {@inheritdoc}
  14. */
  15. public static function getInfo() {
  16. return array(
  17. 'name' => 'Pager Example',
  18. 'description' => 'Verify the pager functionality',
  19. 'group' => 'Examples',
  20. );
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function setUp() {
  26. // Enable the module.
  27. parent::setUp('pager_example');
  28. }
  29. /**
  30. * Verify the functionality of the example module.
  31. */
  32. public function testPagerPage() {
  33. // No need to login for this test.
  34. $this->drupalGet('examples/pager_example');
  35. $this->assertText('next', 'Found next link');
  36. $this->assertText('last', 'Found last link');
  37. // On the first page we shouldn't see the first
  38. // or previous links.
  39. $this->assertNoText('first', 'No first link on the first page');
  40. $this->assertNoText('previous', 'No previous link on the first page');
  41. // Let's go to the second page.
  42. $this->drupalGet('examples/pager_example', array('query' => array('page' => 1)));
  43. $this->assertText('next', 'Found next link');
  44. $this->assertText('last', 'Found last link');
  45. // On the second page we should also see the first
  46. // and previous links.
  47. $this->assertText('first', 'Found first link');
  48. $this->assertText('previous', 'Found previous link');
  49. }
  50. }