You are here

function CoderSecurityTest::testSecurityTriggerError in Coder 6.2

File

tests/coder_security.test, line 74

Class

CoderSecurityTest

Code

function testSecurityTriggerError() {
  $this
    ->assertCoderPass('  trigger_error(t("Here is some safe_data"));');
  $this
    ->assertCoderPass('  trigger_error(t("Here is some @safe_data", array("@safe_data" => $tainted_data));');
  $this
    ->assertCoderPass('  trigger_error(t("Here is some %safe_data", array("%safe_data" => $tainted_data));');
  $this
    ->assertCoderPass('  trigger_error(t("Here is some @safe_data", $safe_data_array));');
  $this
    ->assertCoderPass('  trigger_error(check_plain($tainted_data));');
  $this
    ->assertCoderPass('  trigger_error(filter_xss_admin($tainted_data));');
  $this
    ->assertCoderPass('  trigger_error(format_plural($tainted_count, "1 item", "@count items"));');
  $this
    ->assertCoderPass('  trigger_error(check_markup($tainted_data));');
  $this
    ->assertCoderPass("  function abc() {\n \$tainted_data = check_plain('mystring');\n  trigger_error(\$tainted_data);\n}");
  $this
    ->assertCoderFail("  function abc() {\n trigger_error(\$tainted_data);\n}");
  $this
    ->assertCoderFail('  trigger_error(t($tainted_data));');
  $this
    ->assertCoderFail('  trigger_error("Here is some ". $tainted_data);');
  $this
    ->assertCoderFail('  trigger_error("Here is some $tainted_data");');
  $this
    ->assertCoderFail('  trigger_error(t("Here is some ". $tainted_data));');
  $this
    ->assertCoderFail('  trigger_error(t("Here is some !tainted_data", array("!tainted_data" => $tainted_data));');
}