public function testLazyConnection() { $client = new PhpIRedisClient('clusterA'); $redis = new LazyConnectionWrapper($client); $this->assertTrue($redis->connect('localhost')); $this->assertFalse($redis->isConnected()); $this->assertFalse($client->isConnected()); $this->assertEquals(true, $redis->setEx('testLazy', 60, 1)); $this->assertTrue($redis->isConnected()); $this->assertTrue($client->isConnected()); }
public function tearDown() { // Flush redis after each run to prevent side effects try { if ($this->realRedis && $this->realRedis->isConnected()) { $this->realRedis->flushdb(); $this->realRedis->disconnect(); } } catch (Exception $e) { // we don't care about these exceptions } }