function FormElementInlineErrorTest::testDisplayErrorMessagesNotInline
Same name in other branches
- 9 core/modules/inline_form_errors/tests/src/Kernel/FormElementInlineErrorTest.php \Drupal\Tests\inline_form_errors\Kernel\FormElementInlineErrorTest::testDisplayErrorMessagesNotInline()
- 8.9.x core/modules/inline_form_errors/tests/src/Kernel/FormElementInlineErrorTest.php \Drupal\Tests\inline_form_errors\Kernel\FormElementInlineErrorTest::testDisplayErrorMessagesNotInline()
- 10 core/modules/inline_form_errors/tests/src/Kernel/FormElementInlineErrorTest.php \Drupal\Tests\inline_form_errors\Kernel\FormElementInlineErrorTest::testDisplayErrorMessagesNotInline()
Tests that no inline form errors are shown when disabled for a form.
File
-
core/
modules/ inline_form_errors/ tests/ src/ Kernel/ FormElementInlineErrorTest.php, line 25
Class
- FormElementInlineErrorTest
- Tests messages on form elements.
Namespace
Drupal\Tests\inline_form_errors\KernelCode
public function testDisplayErrorMessagesNotInline() : void {
$form_id = 'test';
$form = [
'#parents' => [],
'#disable_inline_form_errors' => TRUE,
'#array_parents' => [],
];
$form['test'] = [
'#type' => 'textfield',
'#title' => 'Test',
'#parents' => [
'test',
],
'#id' => 'edit-test',
'#array_parents' => [
'test',
],
];
$form_state = new FormState();
\Drupal::formBuilder()->prepareForm($form_id, $form, $form_state);
\Drupal::formBuilder()->processForm($form_id, $form, $form_state);
// Just test if the #error_no_message property is TRUE. FormErrorHandlerTest
// tests if the property actually hides the error message.
$this->assertTrue($form['test']['#error_no_message']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.