function FormDefaultHandlersTest::testDefaultAndCustomHandlers in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Form/FormDefaultHandlersTest.php \Drupal\system\Tests\Form\FormDefaultHandlersTest::testDefaultAndCustomHandlers()
Tests that default handlers are added even if custom are specified.
File
- core/
modules/ system/ src/ Tests/ Form/ FormDefaultHandlersTest.php, line 93 - Contains \Drupal\system\Tests\Form\FormDefaultHandlersTest.
Class
- FormDefaultHandlersTest
- Tests automatically added form handlers.
Namespace
Drupal\system\Tests\FormCode
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
->assertIdentical(count($handlers['validate']), 2);
$this
->assertIdentical($handlers['validate'][0], 'customValidateForm');
$this
->assertIdentical($handlers['validate'][1], 'validateForm');
$this
->assertIdentical(count($handlers['submit']), 2);
$this
->assertIdentical($handlers['submit'][0], 'customSubmitForm');
$this
->assertIdentical($handlers['submit'][1], 'submitForm');
}