class ViewsFormMultipleTest
Same name and namespace in other branches
- 11.x core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php \Drupal\Tests\views\Functional\ViewsFormMultipleTest
- 10 core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php \Drupal\Tests\views\Functional\ViewsFormMultipleTest
- 8.9.x core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php \Drupal\Tests\views\Functional\ViewsFormMultipleTest
Tests a page with multiple Views forms.
@group views
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\views\Functional\ViewsFormMultipleTest extends \Drupal\Tests\views\Functional\ViewTestBase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of ViewsFormMultipleTest
File
-
core/
modules/ views/ tests/ src/ Functional/ ViewsFormMultipleTest.php, line 10
Namespace
Drupal\Tests\views\FunctionalView source
class ViewsFormMultipleTest extends ViewTestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = [
'test_form_multiple',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE, $modules = [
'views_test_config',
]) : void {
parent::setUp($import_test_views, $modules);
$this->enableViewsTestModule();
}
/**
* {@inheritdoc}
*/
protected function viewsData() {
$data = parent::viewsData();
$data['views_test_data']['field_form_button_test']['field'] = [
'title' => 'Button test',
'help' => 'Adds a test form button.',
'id' => 'field_form_button_test',
];
return $data;
}
/**
* Tests the a page with multiple View forms in it.
*/
public function testViewsFormMultiple() {
// 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.