Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function JavaScriptTestCase::testDoubleSubmitFormProtection

Tests the double submit form protection and 'javascript_use_double_submit_protection' variable.

File

modules/simpletest/tests/common.test, line 1793

Class

JavaScriptTestCase
Tests for the JavaScript system.

Code

function testDoubleSubmitFormProtection() {
 // The default front page of the site should have the double submit
 // protection enabled as there is a login block.
 $this->drupalGet ('');
 $this->assertRaw ('misc/form-single-submit.js', 'Default behavior: Double submit protection is enabled.');
 // The default front page should have the double submit protection disabled
 // when the 'javascript_always_use_jquery' variable is set to FALSE or the
 // 'javascript_use_double_submit_protection' variable is set to FALSE.
 variable_set ('javascript_always_use_jquery', FALSE);
 $this->drupalGet ('');
 $this->assertNoRaw ('misc/form-single-submit.js', 'When "javascript_always_use_jquery" is FALSE: Double submit protection is disabled.');
 variable_del ('javascript_always_use_jquery');
 variable_set ('javascript_use_double_submit_protection', FALSE);
 $this->drupalGet ('');
 $this->assertNoRaw ('misc/form-single-submit.js', 'When "javascript_use_double_submit_protection" is FALSE: Double submit protection is disabled.');
 variable_del ('javascript_use_double_submit_protection');
}

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