function ConnectionTest::testMultipleStatementsForNewPhp
Ensure that you cannot execute multiple statements on MySQL.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ ConnectionTest.php, line 124
Class
- ConnectionTest
- Tests of the core database system.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testMultipleStatementsForNewPhp() {
// This just tests mysql, as other PDO integrations don't allow disabling
// multiple statements.
if (Database::getConnection()->databaseType() !== 'mysql') {
$this->markTestSkipped("This test only runs for MySQL");
}
// Disable the protection at the PHP level.
$this->expectException(DatabaseExceptionWrapper::class);
Database::getConnection('default', 'default')->query('SELECT * FROM {test}; SELECT * FROM {test_people}', [], [
'allow_delimiter_in_query' => TRUE,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.