diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 0eaac83..f22cbc8 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -921,13 +921,17 @@ protected function submitForm(array $edit, $submit, $form_html_id = NULL) { // Edit the form values. foreach ($edit as $name => $value) { - // Provide support for 1, 0 for checkboxes instead of TRUE and FALSE. - // @todo Get rid of supporting 1/0. - if (strpos($name, 'name[') === 0) { + $field = $assert_session->fieldExists($name, $form); + + // Provide support for the values '1' and '0' for checkboxes instead of + // TRUE and FALSE. + // @todo Get rid of supporting 1/0 by converting all tests cases using + // this to boolean values. + $field_type = $field->getAttribute('type'); + if ($field_type === 'checkbox') { $value = (bool) $value; } - $field = $assert_session->fieldExists($name, $form); $field->setValue($value); }