Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function create($parameters)
 {
     /** @var ConnectionWrapper $connection */
     $connection = parent::create($parameters);
     if ($connection->getParameters()->logging) {
         if (null !== $this->wrapper) {
             $wrapper = $this->wrapper;
             $connection = new $wrapper($connection);
         }
         $connection->setLogger($this->logger);
     }
     return $connection;
 }
Пример #2
0
 /**
  * @group disconnected
  */
 public function testConstructorWithReplicationArgument()
 {
     $replication = new MasterSlaveReplication();
     $factory = new ConnectionFactory();
     $factory->createAggregated($replication, array('tcp://host1?alias=master', 'tcp://host2?alias=slave'));
     $client = new Client($replication);
     $this->assertInstanceOf('Predis\\Connection\\ReplicationConnectionInterface', $client->getConnection());
     $this->assertSame($replication, $client->getConnection());
 }
Пример #3
0
 /**
  * @group disconnected
  */
 public function testDefineAndUndefineConnection()
 {
     list(, $connectionClass) = $this->getMockConnectionClass();
     $factory = new ConnectionFactory();
     $factory->define('redis', $connectionClass);
     $this->assertInstanceOf($connectionClass, $factory->create('redis://127.0.0.1'));
     $factory->undefine('redis');
     $this->setExpectedException('InvalidArgumentException', 'Unknown connection scheme: redis');
     $factory->create('redis://127.0.0.1');
 }