protected function ConnectionUnitTest::addConnection in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Database/ConnectionUnitTest.php \Drupal\system\Tests\Database\ConnectionUnitTest::addConnection()
Adds a new database connection info to Database.
4 calls to ConnectionUnitTest::addConnection()
- ConnectionUnitTest::testOpenClose in core/
modules/ system/ src/ Tests/ Database/ ConnectionUnitTest.php - Tests Database::closeConnection() without query.
- ConnectionUnitTest::testOpenQueryClose in core/
modules/ system/ src/ Tests/ Database/ ConnectionUnitTest.php - Tests Database::closeConnection() with a query.
- ConnectionUnitTest::testOpenQueryPrefetchClose in core/
modules/ system/ src/ Tests/ Database/ ConnectionUnitTest.php - Tests Database::closeConnection() with a query and custom prefetch method.
- ConnectionUnitTest::testOpenSelectQueryClose in core/
modules/ system/ src/ Tests/ Database/ ConnectionUnitTest.php - Tests Database::closeConnection() with a select query.
File
- core/
modules/ system/ src/ Tests/ Database/ ConnectionUnitTest.php, line 55 - Contains \Drupal\system\Tests\Database\ConnectionUnitTest.
Class
- ConnectionUnitTest
- Tests management of database connections.
Namespace
Drupal\system\Tests\DatabaseCode
protected function addConnection() {
// Add a new target to the connection, by cloning the current connection.
$connection_info = Database::getConnectionInfo($this->key);
Database::addConnectionInfo($this->key, $this->target, $connection_info[$this->originalTarget]);
// Verify that the new target exists.
$info = Database::getConnectionInfo($this->key);
// Note: Custom assertion message to not expose database credentials.
$this
->assertIdentical($info[$this->target], $connection_info[$this->key], 'New connection info found.');
}