You are here

public static function FormTestInputForgeryForm::postRender in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/form_test/src/Form/FormTestInputForgeryForm.php \Drupal\form_test\Form\FormTestInputForgeryForm::postRender()
  2. 10 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"', $rendered_form);
}