You are here

protected function OembedTestHelper::assertRenderedElement in oEmbed 8

Same name and namespace in other branches
  1. 7 oembed.test \OembedTestHelper::assertRenderedElement()
  2. 7.0 oembed.test \OembedTestHelper::assertRenderedElement()
3 calls to OembedTestHelper::assertRenderedElement()
OembedFileEntityTestCase::testOembedFileFormatters in ./oembed.test
Tests the oembed render element types.
OembedFileEntityTestCase::testOembedImageFileFormatters in ./oembed.test
Tests the oembed render element types.
OembedTestCase::testOembedRenderElements in ./oembed.test
Tests the oembed render element types.

File

./oembed.test, line 70
Tests for oembed.module.

Class

OembedTestHelper
@file Tests for oembed.module.

Code

protected function assertRenderedElement(array $element, $xpath, array $xpath_args = array()) {
  $original_element = $element;
  $this
    ->drupalSetContent(drupal_render($element));
  $this
    ->verbose('<pre>' . check_plain(var_export($original_element, TRUE)) . '</pre>' . '<pre>' . check_plain(var_export($element, TRUE)) . '</pre>' . '<hr />' . $this
    ->drupalGetContent());

  // @see DrupalWebTestCase::xpath()
  $xpath = $this
    ->buildXPathQuery($xpath, $xpath_args);
  $element += array(
    '#value' => NULL,
  );
  $type = isset($element['#type']) ? $element['#type'] : 'markup';
  $this
    ->assertFieldByXPath($xpath, $element['#value'], t('#type @type was properly rendered.', array(
    '@type' => var_export($type, TRUE),
  )));
}