diff --git a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php index 0e97267643b..984736fd633 100644 --- a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php +++ b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php @@ -38,21 +38,18 @@ public function __construct( $this->deprecated('Params key "master"', '"primary"'); $params['primary'] = $params['master']; - unset($params['master']); } if (isset($params['slaves'])) { $this->deprecated('Params key "slaves"', '"replica"'); $params['replica'] = $params['slaves']; - unset($params['slaves']); } if (isset($params['keepSlave'])) { $this->deprecated('Params key "keepSlave"', '"keepReplica"'); $params['keepReplica'] = $params['keepSlave']; - unset($params['keepSlave']); } parent::__construct($params, $driver, $config, $eventManager); diff --git a/tests/Doctrine/Tests/DBAL/Connections/MasterSlaveConnectionTest.php b/tests/Doctrine/Tests/DBAL/Connections/MasterSlaveConnectionTest.php new file mode 100644 index 00000000000..0438fcec51a --- /dev/null +++ b/tests/Doctrine/Tests/DBAL/Connections/MasterSlaveConnectionTest.php @@ -0,0 +1,39 @@ + 'pdo_mysql', + 'keepSlave' => true, + 'master' => [ + 'host' => 'master.host', + 'user' => 'root', + 'password' => 'password', + 'port' => '1234', + ], + 'slaves' => [ + [ + 'host' => 'slave1.host', + 'user' => 'root', + 'password' => 'password', + 'port' => '1234', + ], + ], + ]; + + $connection = new MasterSlaveConnection($constructionParams, $this->createMock(Driver::class)); + + $connectionParams = $connection->getParams(); + foreach ($constructionParams as $key => $value) { + self::assertSame($constructionParams[$key], $value); + } + } +}