function FormTest::testInputForgery
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Form/FormTest.php \Drupal\Tests\system\Functional\Form\FormTest::testInputForgery()
- 8.9.x core/modules/system/tests/src/Functional/Form/FormTest.php \Drupal\Tests\system\Functional\Form\FormTest::testInputForgery()
- 10 core/modules/system/tests/src/Functional/Form/FormTest.php \Drupal\Tests\system\Functional\Form\FormTest::testInputForgery()
Tests Form API protections against input forgery.
See also
\Drupal\form_test\Form\FormTestInputForgeryForm
File
-
core/
modules/ system/ tests/ src/ Functional/ Form/ FormTest.php, line 879
Class
- FormTest
- Tests various form element validation mechanisms.
Namespace
Drupal\Tests\system\Functional\FormCode
public function testInputForgery() : void {
$this->drupalGet('form-test/input-forgery');
// The value for checkboxes[two] was changed using post render to simulate
// an input forgery.
// @see \Drupal\form_test\Form\FormTestInputForgeryForm::postRender
$this->submitForm([
'checkboxes[one]' => TRUE,
'checkboxes[two]' => TRUE,
], 'Submit');
$this->assertSession()
->pageTextContains('The submitted value FORGERY in the Checkboxes element is not allowed.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.