function FapiExampleTest::doTestContainerDemoForm

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::doTestContainerDemoForm()

Test the container demo form.

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

File

modules/form_api_example/tests/src/Functional/FapiExampleTest.php, line 145

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->drupalGet(Url::fromRoute('form_api_example.container_demo'));
  $this->submitForm($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');
}