function ConnectionTest::testMultipleStatementsForNewPhp

Same name in other branches
  1. 9 core/modules/mysql/tests/src/Kernel/mysql/ConnectionTest.php \Drupal\Tests\mysql\Kernel\mysql\ConnectionTest::testMultipleStatementsForNewPhp()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php \Drupal\KernelTests\Core\Database\ConnectionTest::testMultipleStatementsForNewPhp()
  3. 10 core/modules/mysql/tests/src/Kernel/mysql/ConnectionTest.php \Drupal\Tests\mysql\Kernel\mysql\ConnectionTest::testMultipleStatementsForNewPhp()

Ensure that you cannot execute multiple statements on MySQL.

File

core/modules/mysql/tests/src/Kernel/mysql/ConnectionTest.php, line 21

Class

ConnectionTest
MySQL-specific connection tests.

Namespace

Drupal\Tests\mysql\Kernel\mysql

Code

public function testMultipleStatementsForNewPhp() : void {
    $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.