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

(cherry picked from commit b8ce3c5f86)
merge-requests/64/head
Alex Pott 2020-02-10 14:46:43 +00:00
parent 791a385ae0
commit d8941ea7b2
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
1 changed files with 6 additions and 4 deletions

View File

@ -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));
}
}