You are here

function CoderReviewSecurityTest::testSecurityPostGetRequest in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_review/tests/coder_review_security.test \CoderReviewSecurityTest::testSecurityPostGetRequest()

Tests the functionality to detect the correct use of getting POST request.

File

coder_review/tests/coder_review_security.test, line 278

Class

CoderReviewSecurityTest
Tests the Coder_review functionality to detect security-related rules.

Code

function testSecurityPostGetRequest() {
  $this
    ->assertCoderReviewPass('  $_POST["safe_data"] = "abc";');
  $this
    ->assertCoderReviewPass('  $_POST["tainted_data"] .= "abc";');
  $this
    ->assertCoderReviewPass('  $post = check_plain($_POST["tainted_data"]);');
  $this
    ->assertCoderReviewPass('  $post = check_markup($_POST["tainted_data"]);');
  $this
    ->assertCoderReviewPass('  $post = filter_xss($_POST["tainted_data"]);');
  $this
    ->assertCoderReviewPass('  $post = filter_xss_admin($_POST["tainted_data"]);');
  $this
    ->assertCoderReviewPass('  $post = form_set_cache($_POST["form_build_id"], $form_state);');
  $this
    ->assertCoderReviewFail('  $post = $_POST["tainted_data"];');
  $this
    ->assertCoderReviewFail('  t($_POST["tainted_data"]);');
}