Commit 8577b2ad authored by alexpott's avatar alexpott

Issue #2871374 by mondrake, daffie, bohart, catch:...

Issue #2871374 by mondrake, daffie, bohart, catch: SelectTest::testVulnerableComment fails when driver overrides Select::__toString

(cherry picked from commit b8ce3c5f)
parent b3eb881b
......@@ -54,15 +54,17 @@ public function testVulnerableComment() {
$records = $result->fetchAll();
$query = (string) $query;
$expected = "/* Testing query comments * / SELECT nid FROM {node}. -- */ SELECT test.name AS name, test.age AS age\nFROM\n{test} test";
$expected = "/* Testing query comments * / SELECT nid FROM {node}. -- */";
$this->assertEqual(count($records), 4, 'Returned the correct number of rows.');
$this->assertNotIdentical(FALSE, strpos($query, $expected), 'The flattened query contains the sanitised comment string.');
// Check the returned number of rows.
$this->assertCount(4, $records);
// Check that the flattened query contains the sanitised comment string.
$this->assertContains($expected, $query);
$connection = Database::getConnection();
foreach ($this->makeCommentsProvider() as $test_set) {
list($expected, $comments) = $test_set;
$this->assertEqual($expected, $connection->makeComment($comments));
$this->assertEquals($expected, $connection->makeComment($comments));
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment