function FormDefaultHandlersTest::testDefaultAndCustomHandlers
Tests that default handlers are added even if custom are specified.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Form/ FormDefaultHandlersTest.php, line 88
Class
- FormDefaultHandlersTest
- Tests automatically added form handlers.
Namespace
Drupal\KernelTests\Core\FormCode
public function testDefaultAndCustomHandlers() {
$form_state = new FormState();
$form_builder = $this->container
->get('form_builder');
$form_builder->submitForm($this, $form_state);
$handlers = $form_state->get('test_handlers');
$this->assertCount(2, $handlers['validate']);
$this->assertIdentical($handlers['validate'][0], 'customValidateForm');
$this->assertIdentical($handlers['validate'][1], 'validateForm');
$this->assertCount(2, $handlers['submit']);
$this->assertIdentical($handlers['submit'][0], 'customSubmitForm');
$this->assertIdentical($handlers['submit'][1], 'submitForm');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.