function ElementTest::testFormElementErrors

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

Tests form element error messages.

1 call to ElementTest::testFormElementErrors()
ElementTest::testFormElements in core/modules/system/tests/src/Functional/Form/ElementTest.php
Test form elements.

File

core/modules/system/tests/src/Functional/Form/ElementTest.php, line 206

Class

ElementTest
Tests building and processing of core form elements.

Namespace

Drupal\Tests\system\Functional\Form

Code

protected function testFormElementErrors() : void {
    $this->drupalGet('form_test/details-form');
    $this->submitForm([], 'Submit');
    $this->assertSession()
        ->pageTextContains('I am an error on the details element.');
}

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