protected function ConnectionUnitTest::addConnection in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php \Drupal\KernelTests\Core\Database\ConnectionUnitTest::addConnection()
Adds a new database connection info to Database.
4 calls to ConnectionUnitTest::addConnection()
- ConnectionUnitTest::testOpenClose in core/
tests/ Drupal/ KernelTests/ Core/ Database/ ConnectionUnitTest.php - Tests Database::closeConnection() without query.
- ConnectionUnitTest::testOpenQueryClose in core/
tests/ Drupal/ KernelTests/ Core/ Database/ ConnectionUnitTest.php - Tests Database::closeConnection() with a query.
- ConnectionUnitTest::testOpenQueryPrefetchClose in core/
tests/ Drupal/ KernelTests/ Core/ Database/ ConnectionUnitTest.php - Tests Database::closeConnection() with a query and custom prefetch method.
- ConnectionUnitTest::testOpenSelectQueryClose in core/
tests/ Drupal/ KernelTests/ Core/ Database/ ConnectionUnitTest.php - Tests Database::closeConnection() with a select query.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ ConnectionUnitTest.php, line 53
Class
- ConnectionUnitTest
- Tests management of database connections.
Namespace
Drupal\KernelTests\Core\DatabaseCode
protected function addConnection() {
// Add a new target to the connection, by cloning the current connection.
$connection_info = Database::getConnectionInfo();
Database::addConnectionInfo('default', static::TEST_TARGET_CONNECTION, $connection_info['default']);
// Verify that the new target exists.
$info = Database::getConnectionInfo();
// New connection info found.
$this
->assertSame($connection_info['default'], $info[static::TEST_TARGET_CONNECTION]);
}