You are here

protected function TestBase::submitForm in Double Field 4.x

Fills and submits a form.

Parameters

array $edit: Field data in an associative array. Changes the current input fields (where possible) to the values indicated.

A checkbox can be set to TRUE to be checked and should be set to FALSE to be unchecked.

string $submit: Value of the submit button whose click is to be emulated. For example, 'Save'. The processing of the request depends on this value. For example, a form may have one button with the value 'Save' and another button with the value 'Delete', and execute different code depending on which one is clicked.

string $form_html_id: (optional) HTML ID of the form to be submitted. On some pages there are many identical forms, so just using the value of the submit button is not enough. For example: 'trigger-node-presave-assign-form'. Note that this is not the Drupal $form_id, but rather the HTML ID of the form, which is typically the same thing but with hyphens replacing the underscores.

Overrides UiHelperTrait::submitForm

1 call to TestBase::submitForm()
WidgetTest::testWidgetForm in tests/src/FunctionalJavascript/WidgetTest.php
Test callback.

File

tests/src/FunctionalJavascript/TestBase.php, line 133

Class

TestBase
Base class for Double Field JavaScript tests.

Namespace

Drupal\Tests\double_field\FunctionalJavascript

Code

protected function submitForm($edit, $submit, $form_html_id = NULL) {
  $new_edit = [];
  foreach ($edit as $name => $value) {
    $new_edit[str_replace('{field_name}', $this->fieldName, $name)] = $value;
  }
  parent::submitForm($new_edit, $submit, $form_html_id);
}