function ExposedFormTest::testFormErrorWithExposedForm

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormTest::testFormErrorWithExposedForm()
  2. 10 core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormTest::testFormErrorWithExposedForm()
  3. 11.x core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormTest::testFormErrorWithExposedForm()

Tests a view which is rendered after a form with a validation error.

File

core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php, line 448

Class

ExposedFormTest
Tests exposed forms functionality.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testFormErrorWithExposedForm() {
    $this->drupalGet('views_test_data_error_form_page');
    $this->assertSession()
        ->statusCodeEquals(200);
    $form = $this->cssSelect('form.views-exposed-form');
    $this->assertNotEmpty($form, 'The exposed form element was found.');
    // Ensure the exposed form is rendered before submitting the normal form.
    $this->assertSession()
        ->responseContains("Apply");
    $this->assertSession()
        ->responseContains('<div class="views-row">');
    $this->submitForm([], 'Submit');
    $this->assertSession()
        ->statusCodeEquals(200);
    $form = $this->cssSelect('form.views-exposed-form');
    $this->assertNotEmpty($form, 'The exposed form element was found.');
    // Ensure the exposed form is rendered after submitting the normal form.
    $this->assertSession()
        ->responseContains("Apply");
    $this->assertSession()
        ->responseContains('<div class="views-row">');
}

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