You are here

function CoderReviewSQLTest::testSQLLowerCaseKeywords in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_review/tests/coder_review_sql.test \CoderReviewSQLTest::testSQLLowerCaseKeywords()

Tests functionality to detect SQL lower case words.

File

coder_review/tests/coder_review_sql.test, line 36

Class

CoderReviewSQLTest
Tests the Coder_review dectection functionality related to SQL.

Code

function testSQLLowerCaseKeywords() {
  $this
    ->assertCoderReviewFail('  $sql = "select * from {node}";');
  $this
    ->assertCoderReviewFail('  $sql = "insert into {node} (changed) VALUES (%d)";');
  $this
    ->assertCoderReviewFail('  $sql = "delete from {node}";');
  $this
    ->assertCoderReviewFail('  $sql = "update {node} set changed = now()";');
  $this
    ->assertCoderReviewPass('  $var = t("select something from this");');
  $this
    ->assertCoderReviewPass('  $var = t("update something");');
  $this
    ->assertCoderReviewPass('  $var = t("insert something");');
  $this
    ->assertCoderReviewPass('  $var = t("delete something");');
  $this
    ->assertCoderReviewPass("  \$notsql = t('Select a role from the list.');");
}