tablesort_example.test

  1. examples
    1. 7 tablesort_example/tablesort_example.test
    2. 8 tablesort_example/tablesort_example.test

Simpletest case for tablesort_example module.

Classes

NameDescription
TableSortExampleTestCaseFunctionality tests for the tablesort example module.

File

tablesort_example/tablesort_example.test
View source
  1. <?php
  2. /**
  3. * @file
  4. * Simpletest case for tablesort_example module.
  5. */
  6. /**
  7. * Functionality tests for the tablesort example module.
  8. */
  9. class TableSortExampleTestCase extends DrupalWebTestCase {
  10. public static function getInfo() {
  11. return array(
  12. 'name' => 'TableSort Example',
  13. 'description' => 'Verify the tablesort functionality',
  14. 'group' => 'Examples',
  15. );
  16. }
  17. function setUp() {
  18. // Enable the module.
  19. parent::setUp('tablesort_example');
  20. }
  21. /**
  22. * Verify the functionality of the example module.
  23. */
  24. function testTableSortPage() {
  25. // no need to login for this test
  26. $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'desc', 'order' => 'Numbers')));
  27. $this->assertRaw('<tbody>
  28. <tr class="odd"><td class="active">7</td><td>e</td><td>t982hkv</td> </tr>', t('Ordered by Number decending'));
  29. $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'asc', 'order' => 'Numbers')));
  30. $this->assertRaw('<tbody>
  31. <tr class="odd"><td class="active">1</td><td>e</td><td>912cv21</td> </tr>', t('Ordered by Number ascending'));
  32. //Sort by Letters
  33. $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'desc', 'order' => 'Letters')));
  34. $this->assertRaw('<tbody>
  35. <tr class="odd"><td>4</td><td class="active">w</td><td>80jsv772</td> </tr>', t('Ordered by Letters decending'));
  36. $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'asc', 'order' => 'Letters')));
  37. $this->assertRaw('<tbody>
  38. <tr class="odd"><td>2</td><td class="active">a</td><td>0kuykuh</td> </tr>', t('Ordered by Letters ascending'));
  39. //Sort by Mixture
  40. $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'desc', 'order' => 'Mixture')));
  41. $this->assertRaw('<tbody>
  42. <tr class="odd"><td>7</td><td>e</td><td class="active">t982hkv</td> </tr>', t('Ordered by Mixture decending'));
  43. $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'asc', 'order' => 'Mixture')));
  44. $this->assertRaw('<tbody>
  45. <tr class="odd"><td>2</td><td>a</td><td class="active">0kuykuh</td> </tr>', t('Ordered by Mixture ascending'));
  46. }
  47. }
Login or register to post comments