1 render_example.test public RenderExampleTestCase::testRenderExampleBasic()

Basic test of rendering through user interaction.

Login user, create an example node, and test blog functionality through the admin and user interfaces.

File

modules/examples/render_example/tests/render_example.test, line 43
Test for the render example module.

Class

RenderExampleTestCase
Functional tests for the Render Example module.

Code

public function testRenderExampleBasic() {

  // Create a user that can access devel information and log in.
  $web_user = $this->backdropCreateUser(array('access devel information', 'access content'));
  $this->backdropLogin($web_user);


  // Test some rendering facets of the various render examples.
  $this->backdropGet('examples/render_example/arrays');
  $content = $this->xpath('//*[@class="render-array"][1]');

  $xpath_array = array(
    '//div[@class="rendered"][starts-with(.,"Some basic text in a #markup")]' => 'Some basic text in a #markup (shows basic markup and how it is rendered)',
    '//div[@class="rendered"][starts-with(.,"This is some text that should be put to")]' => 'This is some text that should be put together | This is some more text that we need | ',
    '//div[@class="rendered"][starts-with(.,"The current time was")]' => 'The current time was  when this was cached. Updated every  seconds',
    '//div[@class="rendered"]/div[text()][starts-with(.,"(prefix)This one")]' => '(prefix)This one adds a prefix and suffix, which put a div around the item(suffix)',
    '//div[@class="rendered"]/div[text()][starts-with(.,"markup for pre_")]' => 'markup for pre_render and post_render example',
    '//div[@class="rendered"]/div[text()][starts-with(.,"This markup was added")]' => 'This markup was added after rendering by a #post_render',
    '//div[@class="rendered"]/div[text()][starts-with(.,"This #suffix")]' => 'This #suffix was added by a #pre_render',
  );
  $this->assertRenderedText($xpath_array);

}