Пример #1
0
 /**
  * @covers Pcelta\Doctrine\Cache\Factory\Redis::create
  * @covers Pcelta\Doctrine\Cache\Factory\AbstractFactory::__construct
  */
 public function testCreateShouldReturnRedisInstance()
 {
     if (!extension_loaded(Redis::MODULE_NAME)) {
         $this->markTestSkipped('Redis Module Is Not Installed');
         return;
     }
     $params = ['host' => '127.0.0.1', 'port' => 11211, 'adapter_name' => 'Any', 'is_connectable' => true];
     $config = new \Pcelta\Doctrine\Cache\Entity\Config($params);
     $factory = new Redis();
     $result = $factory->create($config);
     $this->assertInstanceOf('\\Redis', $result);
 }
Пример #2
0
 /**
  * @param Config $config
  *
  * @return \Redis
  */
 public function create(Config $config)
 {
     $redis = new \Redis();
     $redis->connect($config->getHost(), $config->getPort());
     return $redis;
 }