3 namespace Drupal\Tests\views\Functional;
6 * Tests a page with multiple Views forms.
10 class ViewsFormMultipleTest extends ViewTestBase {
13 * Views used by this test.
17 public static $testViews = ['test_form_multiple'];
22 protected function setUp($import_test_views = TRUE) {
23 parent::setUp($import_test_views);
25 $this->enableViewsTestModule();
31 protected function viewsData() {
32 $data = parent::viewsData();
33 $data['views_test_data']['field_form_button_test']['field'] = [
34 'title' => t('Button test'),
35 'help' => t('Adds a test form button.'),
36 'id' => 'field_form_button_test',
42 * Tests the a page with multiple View forms in it.
44 public function testViewsFormMultiple() {
46 $this->drupalGet('views_test_form_multiple');
48 $this->assertText('Test base form ID with Views forms and arguments.');
50 // Submit the forms, validate argument returned in message set by handler.
51 // @note There is not a way to specify a specific index for a submit button. So
52 // the row index returned is always the last occurrence.
53 $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4--2');
54 $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg2 was submitted.');
55 $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4');
56 $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg1 was submitted.');