Issue #2871374 by mondrake, daffie, bohart, catch: SelectTest::testVulnerableComment fails when driver overrides Select::__toString
(cherry picked from commit b8ce3c5f86
)
merge-requests/64/head
parent
791a385ae0
commit
d8941ea7b2
|
@ -54,15 +54,17 @@ class SelectTest extends DatabaseTestBase {
|
|||
$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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue