public function FormStateTest::testFormErrorsDuringSubmission in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Form/FormStateTest.php \Drupal\Tests\Core\Form\FormStateTest::testFormErrorsDuringSubmission()
Tests that form errors during submission throw an exception.
@covers ::setErrorByName
@expectedException \LogicException @expectedExceptionMessage Form errors cannot be set after form validation has finished.
File
- core/
tests/ Drupal/ Tests/ Core/ Form/ FormStateTest.php, line 139 - Contains \Drupal\Tests\Core\Form\FormStateTest.
Class
- FormStateTest
- @coversDefaultClass \Drupal\Core\Form\FormState
Namespace
Drupal\Tests\Core\FormCode
public function testFormErrorsDuringSubmission() {
$form_state = new FormState();
$form_state
->setValidationComplete();
$form_state
->setErrorByName('test', 'message');
}