function FormDefaultHandlersTest::testValueCallbackServiceNotation
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php \Drupal\KernelTests\Core\Form\FormDefaultHandlersTest::testValueCallbackServiceNotation()
Tests a #value_callback defined using service notation.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Form/ FormDefaultHandlersTest.php, line 100
Class
- FormDefaultHandlersTest
- Tests automatically added form handlers.
Namespace
Drupal\KernelTests\Core\FormCode
public function testValueCallbackServiceNotation() : void {
$form_state = (new FormState())->setValues([
'name' => 'foo',
]);
$form_state->set('value_callback', ValueCallbackTestHelper::class . ':upperCaseValue');
$this->container
->get('form_builder')
->submitForm($this, $form_state);
$this->assertSame('FOO', $form_state->getValue('name'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.