1 form.test FormsTestCase::testInputForgery()

Test Form API protections against input forgery.

See also

_form_test_input_forgery()

File

core/modules/simpletest/tests/form.test, line 595
Unit tests for the Backdrop Form API.

Class

FormsTestCase

Code

function testInputForgery() {
  $this->backdropGet('form-test/input-forgery');
  $checkbox = $this->xpath('//input[@name="checkboxes[two]"]');
  $checkbox[0]['value'] = 'FORGERY';
  $this->backdropPost(NULL, array('checkboxes[one]' => TRUE, 'checkboxes[two]' => TRUE), t('Submit'));
  $message = t('Invalid option %choice in %name element', array('%choice' => 'FORGERY', '%name' => 'checkboxes'));
  $this->assertRaw($message, 'Input forgery was detected.');
}