function ViewsFormMultipleTest::testViewsFormMultiple

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php \Drupal\Tests\views\Functional\ViewsFormMultipleTest::testViewsFormMultiple()
  2. 8.9.x core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php \Drupal\Tests\views\Functional\ViewsFormMultipleTest::testViewsFormMultiple()
  3. 10 core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php \Drupal\Tests\views\Functional\ViewsFormMultipleTest::testViewsFormMultiple()

Tests the a page with multiple View forms in it.

File

core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php, line 51

Class

ViewsFormMultipleTest
Tests a page with multiple Views forms.

Namespace

Drupal\Tests\views\Functional

Code

public function testViewsFormMultiple() : void {
    // Get the test page.
    $this->drupalGet('views_test_form_multiple');
    $this->assertSession()
        ->pageTextContains('Test base form ID with Views forms and arguments.');
    // 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->getSession()
        ->getPage()
        ->pressButton('edit-field-form-button-test-4--2');
    $this->assertSession()
        ->pageTextContains('The test button at row 4 for test_form_multiple (default) View with args: arg2 was submitted.');
    $this->getSession()
        ->getPage()
        ->pressButton('edit-field-form-button-test-4');
    $this->assertSession()
        ->pageTextContains('The test button at row 4 for test_form_multiple (default) View with args: arg1 was submitted.');
}

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