You are here

private function ConnectionTest::createConnection in Drupal 9

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Database/Driver/mysql/ConnectionTest.php \Drupal\Tests\Core\Database\Driver\mysql\ConnectionTest::createConnection()

Creates a Connection object for testing.

Return value

\Drupal\Core\Database\Driver\mysql\Connection

1 call to ConnectionTest::createConnection()
ConnectionTest::testVersionAndIsMariaDb in core/tests/Drupal/Tests/Core/Database/Driver/mysql/ConnectionTest.php
@covers ::version @covers ::isMariaDb @dataProvider providerVersionAndIsMariaDb

File

core/tests/Drupal/Tests/Core/Database/Driver/mysql/ConnectionTest.php, line 43

Class

ConnectionTest
Tests MySQL database connections.

Namespace

Drupal\Tests\Core\Database\Driver\mysql

Code

private function createConnection() : Connection {

  /** @var \PDO $pdo_connection */
  $pdo_connection = $this->pdoConnection
    ->reveal();
  return new class($pdo_connection) extends Connection {
    public function __construct(\PDO $connection) {
      $this->connection = $connection;
    }

  };
}