Ejemplo n.º 1
1
 /**
  * @dataProvider provideInvalidCreateConnection
  * @expectedException Symfony\Component\Cache\Exception\InvalidArgumentException
  * @expectedExceptionMessage Invalid Redis DSN
  */
 public function testInvalidCreateConnection($dsn)
 {
     RedisAdapter::createConnection($dsn);
 }
Ejemplo n.º 2
0
 public function testCreateConnection()
 {
     $redis = RedisAdapter::createConnection('redis://localhost/1', array('class' => \Predis\Client::class, 'timeout' => 3));
     $this->assertInstanceOf(\Predis\Client::class, $redis);
     $connection = $redis->getConnection();
     $this->assertInstanceOf(StreamConnection::class, $connection);
     $params = array('scheme' => 'tcp', 'host' => 'localhost', 'path' => '', 'dbindex' => '1', 'port' => 6379, 'class' => 'Predis\\Client', 'timeout' => 3, 'persistent' => 0, 'read_timeout' => 0, 'retry_interval' => 0, 'database' => '1', 'password' => null);
     $this->assertSame($params, $connection->getParameters()->toArray());
 }
 /**
  * Gets the 'cache.default_redis_provider' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Redis A Redis instance
  */
 protected function getCache_DefaultRedisProviderService()
 {
     return $this->services['cache.default_redis_provider'] = \Symfony\Component\Cache\Adapter\RedisAdapter::createConnection('redis://localhost');
 }