ViewsFormMultipleTest.php in Drupal 8
File
core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php
View source
<?php
namespace Drupal\Tests\views\Functional;
class ViewsFormMultipleTest extends ViewTestBase {
public static $testViews = [
'test_form_multiple',
];
protected $defaultTheme = 'stark';
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this
->enableViewsTestModule();
}
protected function viewsData() {
$data = parent::viewsData();
$data['views_test_data']['field_form_button_test']['field'] = [
'title' => t('Button test'),
'help' => t('Adds a test form button.'),
'id' => 'field_form_button_test',
];
return $data;
}
public function testViewsFormMultiple() {
$this
->drupalGet('views_test_form_multiple');
$this
->assertText('Test base form ID with Views forms and arguments.');
$this
->getSession()
->getPage()
->pressButton('edit-field-form-button-test-4--2');
$this
->assertText('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
->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg1 was submitted.');
}
}