コード例 #1
0
ファイル: RedisDriverTest.php プロジェクト: savritsky/cache
 public function testSetWithoutTtl()
 {
     /** @var \PHPUnit_Framework_MockObject_MockObject|\Redis $redis */
     $redis = $this->getMock(\Redis::class, ['set', 'setex']);
     $redis->expects($this->once())->method('set');
     $redis->expects($this->never())->method('setex');
     $driver = new RedisDriver($redis);
     $driver->set('foo', 'bar');
 }
コード例 #2
0
 /**
  * @requires extension redis
  */
 protected function setUp()
 {
     if (!extension_loaded('redis')) {
         $this->markTestSkipped('redis extension not installed');
     }
     $redis = new \Redis();
     if (false === @$redis->connect('127.0.0.1')) {
         $this->markTestSkipped('Could not connect to Redis instance');
     }
     $redis->flushAll();
     $this->driver = new RedisDriver($redis);
     $this->driver->clear();
     parent::setUp();
 }