protected function FormElementsRenderTest::assertRenderedElement in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php \Drupal\Tests\system\Kernel\Common\FormElementsRenderTest::assertRenderedElement()
Tests that elements are rendered properly.
1 call to FormElementsRenderTest::assertRenderedElement()
- FormElementsRenderTest::testDrupalRenderFormElements in core/
modules/ system/ tests/ src/ Kernel/ Common/ FormElementsRenderTest.php - Tests rendering form elements without passing through \Drupal::formBuilder()->doBuildForm().
File
- core/
modules/ system/ tests/ src/ Kernel/ Common/ FormElementsRenderTest.php, line 143
Class
- FormElementsRenderTest
- Performs integration tests on drupal_render().
Namespace
Drupal\Tests\system\Kernel\CommonCode
protected function assertRenderedElement(array $element, $xpath, array $xpath_args = []) {
$this
->render($element);
$xpath = $this
->buildXPathQuery($xpath, $xpath_args);
$element += [
'#value' => NULL,
];
$this
->assertFieldByXPath($xpath, $element['#value'], new FormattableMarkup('#type @type was properly rendered.', [
'@type' => var_export($element['#type'], TRUE),
]));
}