ConnectionTest.php

Same filename in this branch
  1. 9 core/modules/sqlite/tests/src/Unit/ConnectionTest.php
  2. 9 core/modules/mysql/tests/src/Unit/ConnectionTest.php
  3. 9 core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php
  4. 9 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
Same filename in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php
  2. 8.9.x core/tests/Drupal/Tests/Core/Database/Driver/sqlite/ConnectionTest.php
  3. 8.9.x core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
  4. 10 core/modules/sqlite/tests/src/Unit/ConnectionTest.php
  5. 10 core/modules/sqlite/tests/src/Kernel/sqlite/ConnectionTest.php
  6. 10 core/modules/mysql/tests/src/Unit/ConnectionTest.php
  7. 10 core/modules/mysql/tests/src/Kernel/mysql/ConnectionTest.php
  8. 10 core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php
  9. 10 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
  10. 11.x core/modules/sqlite/tests/src/Unit/ConnectionTest.php
  11. 11.x core/modules/mysql/tests/src/Unit/ConnectionTest.php
  12. 11.x core/modules/mysql/tests/src/Kernel/mysql/ConnectionTest.php
  13. 11.x core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php
  14. 11.x core/tests/Drupal/Tests/Core/Database/ConnectionTest.php

Namespace

Drupal\Tests\mysql\Kernel\mysql

File

core/modules/mysql/tests/src/Kernel/mysql/ConnectionTest.php

View source
<?php

namespace Drupal\Tests\mysql\Kernel\mysql;

use Drupal\Core\Database\Database;
use Drupal\Core\Database\DatabaseExceptionWrapper;
use Drupal\KernelTests\Core\Database\DriverSpecificDatabaseTestBase;

/**
 * MySQL-specific connection tests.
 *
 * @group Database
 */
class ConnectionTest extends DriverSpecificDatabaseTestBase {
    
    /**
     * Ensure that you cannot execute multiple statements on MySQL.
     */
    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,
        ]);
    }

}

Classes

Title Deprecated Summary
ConnectionTest MySQL-specific connection tests.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.