function ComponentInFormTest::submitForm

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Components/ComponentInFormTest.php \Drupal\KernelTests\Components\ComponentInFormTest::submitForm()

File

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

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.