public function FormStateTest::testGetError in Drupal 9
Same name and namespace in other branches
- 8 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()
Tests the getError() method.
@covers ::getError
@dataProvider providerTestGetError
File
- core/
tests/ Drupal/ Tests/ Core/ Form/ FormStateTest.php, line 78 - Contains \Drupal\Tests\Core\Form\FormStateTest.
Class
- FormStateTest
- @coversDefaultClass \Drupal\Core\Form\FormState
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));
}