コード例 #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
ファイル: ClientTest.php プロジェクト: rodrigopbel/ong
 /**
  * @group disconnected
  */
 public function testConstructorWithConnectionArgument()
 {
     $factory = new ConnectionFactory();
     $connection = $factory->create('tcp://localhost:7000');
     $client = new Client($connection);
     $this->assertInstanceOf('Predis\\Connection\\SingleConnectionInterface', $client->getConnection());
     $this->assertSame($connection, $client->getConnection());
     $parameters = $client->getConnection()->getParameters();
     $this->assertSame($parameters->host, 'localhost');
     $this->assertSame($parameters->port, 7000);
 }
コード例 #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');
 }