1 theming_example.test public ThemingExampleTestCase::testThemingPage()

Verify the functionality of the example module.

File

modules/examples/theming_example/tests/theming_example.test, line 28
Simpletest case for theming_example module.

Class

ThemingExampleTestCase
Functional tests for the theming example module.

Code

public function testThemingPage() {
  // No need to login for this test.
  // Check that the main page has been themed (first line with <b>) and has
  // content.
  $this->backdropGet('examples/theming_example');
  $this->assertRaw('<strong>Some examples of pages');
  $this->assertRaw('examples/theming_example/theming_example_select_form">Simple form 1</a>');

  // Visit the list demonstration page and check that CSS gets loaded and do
  // some spot checks on how the two lists were themed.
  $this->backdropGet('examples/theming_example/theming_example_list_page');
  $this->assertPattern('/@import.*theming_example.css/');
  $first_ul = $this->xpath('//ul[contains(@class,"render-version-list")]');
  $this->assertTrue($first_ul[0]->li[0] == 'First item');
  $second_ul = $this->xpath('//ol[contains(@class,"theming-example-list")]');
  $this->assertTrue($second_ul[0]->li[1] == 'Second item');

  // Visit the select form page to do spot checks.
  $this->backdropGet('examples/theming_example/theming_example_select_form');
  // We did explicit theming to accomplish the below...
  $this->assertRaw('<strong>Choose which ordering you want</strong>');
  $this->assertRaw('<div class="container-inline"><div class="form-item form-type-select form-item-choice">');
  $this->assertNoPattern('/@import.*theming_example.css/');

  // Visit the text form page and do spot checks.
  $this->backdropGet('examples/theming_example/theming_example_text_form');
  $this->assertText('Please input something!');
  // If it were themed normally there would be a div wrapper in our pattern.
  $this->assertPattern('%</div>\s*<input +type="submit"%');
}