protected function DrupalRenderTestCase::assertRenderedElement
7.x common.test | protected DrupalRenderTestCase::assertRenderedElement(array $element, $xpath, array $xpath_args = array()) |
1 call to DrupalRenderTestCase::assertRenderedElement()
- DrupalRenderTestCase::testDrupalRenderFormElements in drupal-7.x/
modules/ simpletest/ tests/ common.test - Test rendering form elements without passing through form_builder().
File
- drupal-7.x/
modules/ simpletest/ tests/ common.test, line 1879 - Tests for common.inc functionality.
Class
- DrupalRenderTestCase
- Tests for drupal_render().
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);
$this->assertFieldByXPath($xpath, $element['#value'], format_string('#type @type was properly rendered.', array(
'@type' => var_export($element['#type'], TRUE),
)));
}