You are here

public function ExposedFormTest::testFormErrorWithExposedForm in Drupal 8

Same name and namespace in other branches
  1. 9 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()

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

File

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

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.');
  $this
    ->assertRaw(t('Apply'), 'Ensure the exposed form is rendered before submitting the normal form.');
  $this
    ->assertRaw('<div class="views-row">', 'Views result shown.');
  $this
    ->drupalPostForm(NULL, [], t('Submit'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $form = $this
    ->cssSelect('form.views-exposed-form');
  $this
    ->assertNotEmpty($form, 'The exposed form element was found.');
  $this
    ->assertRaw(t('Apply'), 'Ensure the exposed form is rendered after submitting the normal form.');
  $this
    ->assertRaw('<div class="views-row">', 'Views result shown.');
}