function FapiExampleTest::doTestAjaxColorForm

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

Test the ajax demo form.

1 call to FapiExampleTest::doTestAjaxColorForm()
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 105

Class

FapiExampleTest
Ensure that the form_api_example forms work properly.

Namespace

Drupal\Tests\form_api_example\Functional

Code

public function doTestAjaxColorForm() {
    $assert = $this->assertSession();
    // Post the form.
    $edit = [
        'temperature' => 'warm',
    ];
    $this->drupalGet(Url::fromRoute('form_api_example.ajax_color_demo'));
    $this->submitForm($edit, 'Submit');
    $assert->statusCodeEquals(200);
    $assert->pageTextContains('Value for Temperature: warm');
}