function FormTestInputForgeryForm::postRender

Same name in other branches
  1. 9 core/modules/system/tests/modules/form_test/src/Form/FormTestInputForgeryForm.php \Drupal\form_test\Form\FormTestInputForgeryForm::postRender()
  2. 8.9.x core/modules/system/tests/modules/form_test/src/Form/FormTestInputForgeryForm.php \Drupal\form_test\Form\FormTestInputForgeryForm::postRender()
  3. 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestInputForgeryForm.php \Drupal\form_test\Form\FormTestInputForgeryForm::postRender()

Alters the rendered form to simulate input forgery.

It's necessary to alter the rendered form here because Mink does not support manipulating the DOM tree.

Parameters

string $rendered_form: The rendered form.

Return value

string The modified rendered form.

See also

\Drupal\Tests\system\Functional\Form\FormTest::testInputForgery()

File

core/modules/system/tests/modules/form_test/src/Form/FormTestInputForgeryForm.php, line 61

Class

FormTestInputForgeryForm
Form to test input forgery.

Namespace

Drupal\form_test\Form

Code

public static function postRender($rendered_form) {
    return str_replace('value="two"', 'value="FORGERY"', (string) $rendered_form);
}

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