1.20.x database_test.test protected ConnectionUnitTest::addConnection()

Adds a new database connection info to Database.

File

modules/simpletest/tests/database_test.test, line 3948
Database tests.

Class

ConnectionUnitTest
Tests management of database connections.

Code

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.');
}