You are here

function CoderReviewSecurityTest::testSecurityBlockSubject in Coder 7.2

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

Tests the functionality to detect correct use of $block['subject'] key.

File

coder_review/tests/coder_review_security.test, line 310

Class

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

Code

function testSecurityBlockSubject() {
  $this
    ->assertCoderReviewPass("  function mymodule_block() {\n  \$block['subject'] = 'title';\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_block() {\n  \$block['subject'] = check_plain(\$title);\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_block() {\n  \$block['subject'] = \$title;\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_block() {\n  \$block = array(\n 'subject' => \$title,\n  );\n}");
}