function StorageTest::testValidation

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/StorageTest.php \Drupal\Tests\system\Functional\Form\StorageTest::testValidation()
  2. 8.9.x core/modules/system/tests/src/Functional/Form/StorageTest.php \Drupal\Tests\system\Functional\Form\StorageTest::testValidation()
  3. 10 core/modules/system/tests/src/Functional/Form/StorageTest.php \Drupal\Tests\system\Functional\Form\StorageTest::testValidation()

Tests validation when form storage is used.

File

core/modules/system/tests/src/Functional/Form/StorageTest.php, line 101

Class

StorageTest
Tests a multistep form using form storage.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testValidation() : void {
    $this->drupalGet('form_test/form-storage');
    $this->submitForm([
        'title' => '',
        'value' => 'value_is_set',
    ], 'Continue submit');
    // Ensure that the input values have been kept.
    $this->assertSession()
        ->responseMatches('/value_is_set/');
}

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