theming_example.test

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

Simpletest case for theming_example module.

Classes

NameDescription
ThemingExampleTestCaseFunctionality tests for the theming example module.

File

theming_example/theming_example.test
View source
  1. <?php
  2. /**
  3. * @file
  4. * Simpletest case for theming_example module.
  5. */
  6. /**
  7. * Functionality tests for the theming example module.
  8. */
  9. class ThemingExampleTestCase extends DrupalWebTestCase {
  10. public static function getInfo() {
  11. return array(
  12. 'name' => 'Theming Example',
  13. 'description' => 'Verify theming example functionality',
  14. 'group' => 'Examples',
  15. );
  16. }
  17. function setUp() {
  18. // Enable the module.
  19. parent::setUp('theming_example');
  20. }
  21. /**
  22. * Verify the functionality of the example module.
  23. */
  24. function testThemingPage() {
  25. // no need to login for this test
  26. // Check that the main page has been themed (first line with <b>) and has content.
  27. $this->drupalGet('examples/theming_example');
  28. $this->assertRaw('<strong>Some examples of pages');
  29. $this->assertRaw('examples/theming_example/theming_example_order_form">Simple form 1</a>');
  30. // Visit the list demonstration page and check that css gets loaded
  31. // and do some spot checks on how the two lists were themed.
  32. $this->drupalGet('examples/theming_example/theming_example_list_page');
  33. $this->assertPattern('/@import.*theming_example.css/');
  34. $first_ul = $this->xpath('//ul[contains(@class,"render-version-list")]');
  35. $this->assertTrue($first_ul[0]->li[0] == 'First item');
  36. $second_ul = $this->xpath('//ol[contains(@class,"theming-example-list")]');
  37. $this->assertTrue($second_ul[0]->li[1] == 'Second item');
  38. // Visit the select form page to do spot checks.
  39. $this->drupalGet('examples/theming_example/theming_example_select_form');
  40. // We did explicit theming to accomplish the below...
  41. $this->assertRaw('<strong>Choose which ordering you want</strong>');
  42. $this->assertRaw('<div class="container-inline"><div class="form-item form-type-select form-item-choice">');
  43. $this->assertNoPattern('/@import.*theming_example.css/');
  44. // Visit the text form page and do spot checks.
  45. $this->drupalGet('examples/theming_example/theming_example_text_form');
  46. $this->assertText('Please input something!');
  47. $this->assertPattern('%</div>\s*<input +type="submit"%'); // If it were themed normally there would be a div wrapper here
  48. }
  49. }
Login or register to post comments