You are here

public function FapiExampleTest::doTestStateDemoForm in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/form_api_example/tests/src/Functional/FapiExampleTest.php \Drupal\Tests\form_api_example\Functional\FapiExampleTest::doTestStateDemoForm()

Test the state demo form.

1 call to FapiExampleTest::doTestStateDemoForm()
FapiExampleTest::testFunctional in form_api_example/tests/src/Functional/FapiExampleTest.php
Aggregate all the tests.

File

form_api_example/tests/src/Functional/FapiExampleTest.php, line 246

Class

FapiExampleTest
Ensure that the form_api_example forms work properly.

Namespace

Drupal\Tests\form_api_example\Functional

Code

public function doTestStateDemoForm() {
  $assert = $this
    ->assertSession();

  // Post the form.
  $edit = [
    'needs_accommodation' => TRUE,
    'diet' => 'vegan',
  ];
  $this
    ->drupalPostForm(Url::fromRoute('form_api_example.state_demo'), $edit, 'Submit');
  $assert
    ->pageTextContains('Dietary Restriction Requested: vegan');
}