function FormDefaultHandlersTest::testValueCallbackInvalidDefinitionThrows
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php \Drupal\KernelTests\Core\Form\FormDefaultHandlersTest::testValueCallbackInvalidDefinitionThrows()
Tests that an unresolvable #value_callback throws an exception.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Form/ FormDefaultHandlersTest.php, line 111
Class
- FormDefaultHandlersTest
- Tests automatically added form handlers.
Namespace
Drupal\KernelTests\Core\FormCode
public function testValueCallbackInvalidDefinitionThrows() : void {
$form_state = (new FormState())->setValues([
'name' => 'foo',
]);
$form_state->set('value_callback', 'this_callback_does_not_exist');
$this->expectException(\InvalidArgumentException::class);
$this->container
->get('form_builder')
->submitForm($this, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.