function FormElementsRenderTest::assertRenderedElement
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php \Drupal\Tests\system\Kernel\Common\FormElementsRenderTest::assertRenderedElement()
- 8.9.x core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php \Drupal\Tests\system\Kernel\Common\FormElementsRenderTest::assertRenderedElement()
- 10 core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php \Drupal\Tests\system\Kernel\Common\FormElementsRenderTest::assertRenderedElement()
Tests that elements are rendered properly.
@internal
1 call to FormElementsRenderTest::assertRenderedElement()
- FormElementsRenderTest::testDrupalRenderFormElements in core/
modules/ system/ tests/ src/ Kernel/ Common/ FormElementsRenderTest.php - Tests rendering form elements without using doBuildForm().
File
-
core/
modules/ system/ tests/ src/ Kernel/ Common/ FormElementsRenderTest.php, line 148
Class
- FormElementsRenderTest
- Performs integration tests on \Drupal::service('renderer')->render().
Namespace
Drupal\Tests\system\Kernel\CommonCode
protected function assertRenderedElement(array $element, string $xpath, array $xpath_args = []) : void {
$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),
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.