You are here

function CoderReviewSQLTest::testSQLBackTick in Coder 7.2

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

Tests functionality to detect correct use of backtick in SQL statements.

File

coder_review/tests/coder_review_sql.test, line 73

Class

CoderReviewSQLTest
Tests the Coder_review dectection functionality related to SQL.

Code

function testSQLBackTick() {
  $this
    ->assertCoderReviewFail('  $sql = "SELECT * FROM {node} WHERE title=`abc`";');
  $this
    ->assertCoderReviewFail('  $sql = "INSERT INTO {foo} (nid, title) VALUES (\'1\', `abc`)";');
  $this
    ->assertCoderReviewFail('  $sql = "INSERT INTO {foo} VALUES (\'1\', `abc`)";');
  $this
    ->assertCoderReviewFail('  $sql = "UPDATE {foo} SET nid=\'1\', title=`abc`";');
  $this
    ->assertCoderReviewFail('  $sql = "DELETE FROM {foo} WHERE nid=\'1\' AND title=`abc`";');
}