diff --git a/core/modules/views/src/Tests/ViewsFormMultipleTest.php b/core/modules/views/src/Tests/ViewsFormMultipleTest.php index 8feaecb..6d8baa6 100644 --- a/core/modules/views/src/Tests/ViewsFormMultipleTest.php +++ b/core/modules/views/src/Tests/ViewsFormMultipleTest.php @@ -51,14 +51,13 @@ public function testViewsFormMultiple() { // Get the test page. $this->drupalGet('views_test_form_multiple'); - // Look for the first button of the second view form. - // @todo. - - // Submit the form for the button found. - // @todo. - - // Display the message returned by the button submission. - // @todo. + // Submit the forms, validate argument returned in message set by handler. + // @note There is not a way to specify a specific index for a submit button. So + // the row index returned is always the last occurrence. + $this->drupalPostForm(NULL, [], t('Test Button'), [], [], 'views-form-test-form-multiple-default-arg2'); + $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg2 was submitted.'); + $this->drupalPostForm(NULL, [], t('Test Button'), [], [], 'views-form-test-form-multiple-default-arg1'); + $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg1 was submitted.'); } } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php index a1c9b8f..95a4a98 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php @@ -73,7 +73,12 @@ public function viewsFormSubmit(&$form, FormStateInterface $form_state) { if (!empty($triggering_element['#test_button'])) { $row_index = $triggering_element['#row_index']; $view_args = !empty($this->view->args) ? implode(', ', $this->view->args) : $this->t('no arguments'); - drupal_set_message($this->t('The test button for @view_title (@display / @view_id) View with args: @args was submitted.', array('@view_title' => $this->view->getTitle(), '@display' => $this->view->current_display, '@view_id' => $this->view->id(), '@args' => $view_args))); + drupal_set_message($this->t('The test button at row @row_index for @view_id (@display) View with args: @args was submitted.', [ + '@display' => $this->view->current_display, + '@view_id' => $this->view->id(), + '@args' => $view_args, + '@row_index' => $row_index, + ])); } }