function FormStateTest::testGetError
Tests the getError() method.
@legacy-covers ::getError
Attributes
#[DataProvider('providerTestGetError')]
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormStateTest.php, line 76
Class
Namespace
Drupal\Tests\Core\FormCode
public function testGetError($errors, $parents, $error = NULL) : void {
$element['#parents'] = $parents;
$form_state = (new FormState())->setFormState([
'errors' => $errors,
]);
$this->assertSame($error, $form_state->getError($element));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.