Commit 9b2f6484 authored by Vincent CHALAMON's avatar Vincent CHALAMON

Fix bug about get default params on PoolingShardConnection

parent f44782e9
......@@ -141,7 +141,7 @@ class PoolingShardConnection extends Connection
*/
public function getParams()
{
return $this->activeShardId ? $this->connections[$this->activeShardId] : parent::getParams();
return $this->activeShardId ? $this->connections[$this->activeShardId] : $this->connections[0];
}
/**
......
......@@ -209,9 +209,9 @@ class PoolingShardConnectionTest extends \PHPUnit_Framework_TestCase
$conn = DriverManager::getConnection(array(
'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection',
'driver' => 'pdo_sqlite',
'global' => array('memory' => true),
'global' => array('memory' => true, 'host' => 'localhost'),
'shards' => array(
array('id' => 1, 'memory' => true),
array('id' => 1, 'memory' => true, 'host' => 'foo'),
),
'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser',
));
......@@ -219,24 +219,27 @@ class PoolingShardConnectionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(
'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection',
'driver' => 'pdo_sqlite',
'global' => array('memory' => true),
'global' => array('memory' => true, 'host' => 'localhost'),
'shards' => array(
array('id' => 1, 'memory' => true),
array('id' => 1, 'memory' => true, 'host' => 'foo'),
),
'shardChoser' => new MultiTenantShardChoser(),
'memory' => true,
'host' => 'localhost',
), $conn->getParams());
$conn->connect(1);
$this->assertEquals(array(
'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection',
'driver' => 'pdo_sqlite',
'global' => array('memory' => true),
'global' => array('memory' => true, 'host' => 'localhost'),
'shards' => array(
array('id' => 1, 'memory' => true),
array('id' => 1, 'memory' => true, 'host' => 'foo'),
),
'shardChoser' => new MultiTenantShardChoser(),
'id' => 1,
'memory' => true,
'host' => 'foo',
), $conn->getParams());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment