public function create(array $params) { if (!$this->isValidParams($params)) { throw new InvalidCacheConfig(); } $redis = new \Redis(); $redis->connect($params['host'], $params['port']); return $redis; }
/** * @covers Dafiti\Silex\Cache\Factory\Redis::create * @covers Dafiti\Silex\Cache\Factory\Redis::isValidParams * @covers Dafiti\Silex\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]; $factory = new Redis(); $result = $factory->create($params); $this->assertInstanceOf('\\Redis', $result); }