function ViewsFormTest::testFormWrapper

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php \Drupal\Tests\views\Functional\Plugin\ViewsFormTest::testFormWrapper()
  2. 10 core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php \Drupal\Tests\views\Functional\Plugin\ViewsFormTest::testFormWrapper()
  3. 11.x core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php \Drupal\Tests\views\Functional\Plugin\ViewsFormTest::testFormWrapper()

Tests the Views form wrapper.

File

core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php, line 29

Class

ViewsFormTest
Tests Views forms functionality.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testFormWrapper() {
    $this->drupalGet('test_bulk_form');
    // Ensure we have the form tag on the page.
    $xpath = $this->cssSelect('.views-form form');
    $this->assertCount(1, $xpath, 'There is one views form on the page.');
    // Ensure we don't have nested form elements.
    $result = (bool) preg_match('#<form[^>]*?>(?!/form).*<form#s', $this->getSession()
        ->getPage()
        ->getContent());
    $this->assertFalse($result, 'The views form element is not nested.');
}

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