Commit 81b500da authored by Steve Müller's avatar Steve Müller

Merge pull request #912 from vincentchalamon/master

Fix bug about get default params on PoolingShardConnection
parents 532641f0 9b2f6484
...@@ -141,7 +141,7 @@ class PoolingShardConnection extends Connection ...@@ -141,7 +141,7 @@ class PoolingShardConnection extends Connection
*/ */
public function getParams() 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 ...@@ -209,9 +209,9 @@ class PoolingShardConnectionTest extends \PHPUnit_Framework_TestCase
$conn = DriverManager::getConnection(array( $conn = DriverManager::getConnection(array(
'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection',
'driver' => 'pdo_sqlite', 'driver' => 'pdo_sqlite',
'global' => array('memory' => true), 'global' => array('memory' => true, 'host' => 'localhost'),
'shards' => array( 'shards' => array(
array('id' => 1, 'memory' => true), array('id' => 1, 'memory' => true, 'host' => 'foo'),
), ),
'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser', 'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser',
)); ));
...@@ -219,24 +219,27 @@ class PoolingShardConnectionTest extends \PHPUnit_Framework_TestCase ...@@ -219,24 +219,27 @@ class PoolingShardConnectionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array( $this->assertEquals(array(
'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection',
'driver' => 'pdo_sqlite', 'driver' => 'pdo_sqlite',
'global' => array('memory' => true), 'global' => array('memory' => true, 'host' => 'localhost'),
'shards' => array( 'shards' => array(
array('id' => 1, 'memory' => true), array('id' => 1, 'memory' => true, 'host' => 'foo'),
), ),
'shardChoser' => new MultiTenantShardChoser(), 'shardChoser' => new MultiTenantShardChoser(),
'memory' => true,
'host' => 'localhost',
), $conn->getParams()); ), $conn->getParams());
$conn->connect(1); $conn->connect(1);
$this->assertEquals(array( $this->assertEquals(array(
'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection',
'driver' => 'pdo_sqlite', 'driver' => 'pdo_sqlite',
'global' => array('memory' => true), 'global' => array('memory' => true, 'host' => 'localhost'),
'shards' => array( 'shards' => array(
array('id' => 1, 'memory' => true), array('id' => 1, 'memory' => true, 'host' => 'foo'),
), ),
'shardChoser' => new MultiTenantShardChoser(), 'shardChoser' => new MultiTenantShardChoser(),
'id' => 1, 'id' => 1,
'memory' => true, 'memory' => true,
'host' => 'foo',
), $conn->getParams()); ), $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