$records =
$result->
fetchAll();
$query =
(string) $query;
$expected = "/* Testing query comments * / SELECT nid FROM {node}. -- */";
// Check the returned number of rows.
$this->
assertCount(4,
$records);
// Check that the flattened query contains the sanitized comment string.
$this->
assertStringContainsString($expected,
$query);
$connection = Database::
getConnection();
foreach ($this->
makeCommentsProvider() as $test_set) { [$expected,
$comments] =
$test_set;
$this->
assertEquals($expected,
$connection->
makeComment($comments));
} } /**
* Provides expected and input values for testVulnerableComment().
*/
public function makeCommentsProvider() { return [ [