function ExposedFormTest::testFormErrorWithExposedForm

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormTest::testFormErrorWithExposedForm()
  2. 8.9.x core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormTest::testFormErrorWithExposedForm()
  3. 10 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.

1 call to ExposedFormTest::testFormErrorWithExposedForm()
ExposedFormTest::testExposedForm in core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
Tests the input required exposed form type.

File

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

Class

ExposedFormTest
Tests exposed forms functionality.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

protected function testFormErrorWithExposedForm() : void {
    $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.