Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / views / tests / src / Functional / ViewsFormMultipleTest.php
1 <?php
2
3 namespace Drupal\Tests\views\Functional;
4
5 /**
6  * Tests a page with multiple Views forms.
7  *
8  * @group views
9  */
10 class ViewsFormMultipleTest extends ViewTestBase {
11
12   /**
13    * Views used by this test.
14    *
15    * @var array
16    */
17   public static $testViews = ['test_form_multiple'];
18
19   /**
20    * {@inheritdoc}
21    */
22   protected function setUp($import_test_views = TRUE) {
23     parent::setUp($import_test_views);
24
25     $this->enableViewsTestModule();
26   }
27
28   /**
29    * {@inheritdoc}
30    */
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',
37     ];
38     return $data;
39   }
40
41
42   /**
43    * Tests the a page with multiple View forms in it.
44    */
45   public function testViewsFormMultiple() {
46     // Get the test page.
47     $this->drupalGet('views_test_form_multiple');
48
49     $this->assertText('Test base form ID with Views forms and arguments.');
50
51     // Submit the forms, validate argument returned in message set by handler.
52     // @note There is not a way to specify a specific index for a submit button. So
53     // the row index returned is always the last occurrence.
54     $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4--2');
55     $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg2 was submitted.');
56     $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4');
57     $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg1 was submitted.');
58   }
59
60 }