コード例 #1
0
 public function setUp()
 {
     $this->redis = new CallbackRedis([$this, 'callbacker']);
     $this->realRedis = new PhpIRedisClient('someCircle');
     $this->assertTrue($this->realRedis->connect($this->getHost(), $this->getPort()), 'could not connect to redis');
     $this->assertTrue($this->realRedis->select(2), 'could not select database 2');
 }
コード例 #2
0
 public function setUp()
 {
     $this->read = new PhpIRedisClient('localhost');
     $this->read->connect('localhost');
     // TODO: could also use a mock for the write channel
     $this->redis = new FallbackReadWriteWrapper($this->read, new NullConnection());
 }
コード例 #3
0
 public function testAppendToLog()
 {
     $redis = new PhpIRedisClient('someCircle');
     $redis->connect('localhost');
     $monitor = $this->getMockBuilder('\\Plista\\Core\\Redis\\Wrapper\\MonitoringWrapper')->setConstructorArgs(array($redis, '/tmp/xxx.log'))->setMethods(array('appendToLog'))->getMock();
     $monitor->expects($this->once())->method('appendToLog')->with($this->equalTo('SET testKey testValue 0'));
     $monitor->set('testKey', 'testValue', 0);
 }