function FapiExampleTest::doTestContainerDemoForm

Same name in other branches
  1. 3.x modules/form_api_example/tests/src/Functional/FapiExampleTest.php \Drupal\Tests\form_api_example\Functional\FapiExampleTest::doTestContainerDemoForm()
  2. 4.0.x modules/form_api_example/tests/src/Functional/FapiExampleTest.php \Drupal\Tests\form_api_example\Functional\FapiExampleTest::doTestContainerDemoForm()

Test the container demo form.

1 call to FapiExampleTest::doTestContainerDemoForm()
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 142

Class

FapiExampleTest
Ensure that the form_api_example forms work properly.

Namespace

Drupal\Tests\form_api_example\Functional

Code

public function doTestContainerDemoForm() {
    $assert = $this->assertSession();
    // Post the form.
    $edit = [
        'name' => 'Dave',
        'pen_name' => 'DMan',
        'title' => 'My Book',
        'publisher' => 'me',
        'diet' => 'vegan',
    ];
    $this->drupalPostForm(Url::fromRoute('form_api_example.container_demo'), $edit, 'Submit');
    $assert->pageTextContains('Value for name: Dave');
    $assert->pageTextContains('Value for pen_name: DMan');
    $assert->pageTextContains('Value for title: My Book');
    $assert->pageTextContains('Value for publisher: me');
    $assert->pageTextContains('Value for diet: vegan');
}