You are here

function CoderSecurityTest::testSecurityFAPITitleDescription in Coder 6.2

File

tests/coder_security.test, line 252

Class

CoderSecurityTest

Code

function testSecurityFAPITitleDescription() {
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$field = array(\n '#title' => t('%title', array('%title' => \$title)),\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$field = array(\n '#title' => 'abc',\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$field = array(\n '#title' => check_plain(\$title),\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$field = array(\n '#title' => t('%title', array('%title' => \$title)),\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$title = check_plain(\$title);\n  \$field = array(\n '#title' => \$title,\n  );\n}");
  $this
    ->assertCoderPass("  function mymodule_form() {\n  \$title = check_plain(\$title);\n  \$field = array(\n '#title' => t('!title', array('!title' => \$title)),\n  );\n}");
  $this
    ->assertCoderFail("  function mymodule_form() {\n  \$field = array(\n '#title' => \$title,\n  );\n}");
  $this
    ->assertCoderFail("  function mymodule_form() {\n  \$field = array(\n '#description' => \$description,\n  );\n}");
  $this
    ->assertCoderFail("  function mymodule_form_alter() {\n  \$field = array(\n '#title' => \$title,\n  );\n}");
  $this
    ->assertCoderFail("  function mymodule_form() {\n  \$field = array(\n '#title' => t('!title', array('!title' => \$title)),\n  );\n}");
}