TableSortExampleTestCase

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

Functionality tests for the tablesort example module.

Hierarchy

Functions & methods

NameDescription
TableSortExampleTestCase::getInfo
TableSortExampleTestCase::setUp
TableSortExampleTestCase::testTableSortPageVerify the functionality of the example module.

File

tablesort_example/tablesort_example.test, line 10
Simpletest case for tablesort_example module.

View source
class TableSortExampleTestCase extends DrupalWebTestCase {

  public static function getInfo() {
    return array(
      'name' => 'TableSort Example', 
      'description' => 'Verify the tablesort functionality', 
      'group' => 'Examples',
    );
  }

  function setUp() {
    // Enable the module.
    parent::setUp('tablesort_example');
  }

  /**
   * Verify the functionality of the example module.
   */
  function testTableSortPage() {
    // no need to login for this test
    $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'desc', 'order' => 'Numbers')));
    $this->assertRaw('<tbody>
 <tr class="odd"><td class="active">7</td><td>e</td><td>t982hkv</td> </tr>', t('Ordered by Number decending'));

    $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'asc', 'order' => 'Numbers')));
    $this->assertRaw('<tbody>
 <tr class="odd"><td class="active">1</td><td>e</td><td>912cv21</td> </tr>', t('Ordered by Number ascending'));

    //Sort by Letters
    $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'desc', 'order' => 'Letters')));
    $this->assertRaw('<tbody>
 <tr class="odd"><td>4</td><td class="active">w</td><td>80jsv772</td> </tr>', t('Ordered by Letters decending'));

    $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'asc', 'order' => 'Letters')));
    $this->assertRaw('<tbody>
 <tr class="odd"><td>2</td><td class="active">a</td><td>0kuykuh</td> </tr>', t('Ordered by Letters ascending'));

    //Sort by Mixture
    $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'desc', 'order' => 'Mixture')));
    $this->assertRaw('<tbody>
 <tr class="odd"><td>7</td><td>e</td><td class="active">t982hkv</td> </tr>', t('Ordered by Mixture decending'));

    $this->drupalGet('examples/tablesort_example', array('query' => array('sort' => 'asc', 'order' => 'Mixture')));
    $this->assertRaw('<tbody>
 <tr class="odd"><td>2</td><td>a</td><td class="active">0kuykuh</td> </tr>', t('Ordered by Mixture ascending'));
  }
}
Login or register to post comments