function ComponentInFormTest::submitForm

Overrides FormInterface::submitForm

File

core/tests/Drupal/KernelTests/Components/ComponentInFormTest.php, line 103

Class

ComponentInFormTest
Tests the correct rendering of components in form.

Namespace

Drupal\KernelTests\Components

Code

public function submitForm(array &$form, FormStateInterface $form_state) : void {
    // Check that submitted data are present (set with #default_value).
    $data = [
        'normal' => 'fake 1',
        'foo' => 'fake 2',
        'bar' => 'option_1',
    ];
    foreach ($data as $key => $value) {
        $this->assertSame($value, $form_state->getValue($key));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.