You are here

function CoderSecurityTest::testSecurityFAPIMarkupValue in Coder 6.2

File

tests/coder_security.test, line 265

Class

CoderSecurityTest

Code

function testSecurityFAPIMarkupValue() {
  $this
    ->assertCoderPass("  function mymodule_function() {\n  \$field = array(\n '#value' => \$value,\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$field = array(\n '#value' => check_plain(\$value),\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$field = array(\n '#value' => \$value,\n  '#type' => 'textfield',\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$value = check_plain(\$value);\n  \$field = array(\n '#value' => \$value,\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$field = array(\n '#value' => t('%value', array('%value' => \$value)),\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$value = check_plain(\$value);\n  \$field = array(\n '#value' => t('!value', array('!value' => \$value)),\n  );\n}");
  $this
    ->assertCoderFail("  function mymodule_form() {\n  \$field = array(\n '#value' => \$value,\n  );\n}");
  $this
    ->assertCoderFail("  function mymodule_form_alter() {\n  \$field = array(\n '#value' => \$value,\n  );\n}");
  $this
    ->assertCoderFail("  function mymodule_form() {\n  \$field = array(\n '#value' => \$value,\n  '#type' => 'markup',\n  );\n}");
  $this
    ->assertCoderFail("  function mymodule_form() {\n  \$field = array(\n '#type' => 'markup',\n  '#value' => \$value,\n  );\n}");
  $this
    ->assertCoderFail("  function mymodule_form() {\n  \$field = array(\n '#value' => t('!value', array('!value' => \$value)),\n  );\n}");
}