2016-12-30 06:21:17 +01:00
|
|
|
<?php
|
2016-09-14 16:27:39 +02:00
|
|
|
|
|
|
|
namespace Amp\Postgres\Test;
|
|
|
|
|
|
|
|
use Amp\Postgres\AggregatePool;
|
|
|
|
|
2016-09-20 07:47:16 +02:00
|
|
|
class AggregatePoolTest extends AbstractPoolTest {
|
2016-09-14 16:27:39 +02:00
|
|
|
/**
|
|
|
|
* @param array $connections
|
|
|
|
*
|
|
|
|
* @return \Amp\Postgres\Pool
|
|
|
|
*/
|
|
|
|
protected function createPool(array $connections) {
|
|
|
|
$mock = $this->getMockBuilder(AggregatePool::class)
|
|
|
|
->setConstructorArgs(['', 0, count($connections)])
|
|
|
|
->setMethods(['createConnection'])
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$mock->method('createConnection')
|
|
|
|
->will($this->returnCallback(function () {
|
|
|
|
$this->fail('The createConnection() method should not be called.');
|
|
|
|
}));
|
|
|
|
|
|
|
|
foreach ($connections as $connection) {
|
|
|
|
$mock->addConnection($connection);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $mock;
|
|
|
|
}
|
|
|
|
}
|