function FormStateTest::testGetError
Same name and namespace in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Form/FormStateTest.php \Drupal\Tests\Core\Form\FormStateTest::testGetError()
- 10 core/tests/Drupal/Tests/Core/Form/FormStateTest.php \Drupal\Tests\Core\Form\FormStateTest::testGetError()
- 11.x core/tests/Drupal/Tests/Core/Form/FormStateTest.php \Drupal\Tests\Core\Form\FormStateTest::testGetError()
Tests the getError() method.
@covers ::getError
@dataProvider providerTestGetError
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormStateTest.php, line 78
Class
- FormStateTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Form%21FormState.php/class/FormState/9" title="Stores information about the state of a form." class="local">\Drupal\Core\Form\FormState</a>
Namespace
Drupal\Tests\Core\FormCode
public function testGetError($errors, $parents, $error = NULL) {
$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.