shouldReceive('get') ->with('system', 'redis_host') ->andReturn($host); $configMock ->shouldReceive('get') ->with('system', 'redis_port') ->andReturn(null); $configMock ->shouldReceive('get') ->with('system', 'redis_db', 0) ->andReturn(3); $configMock ->shouldReceive('get') ->with('system', 'redis_password') ->andReturn(null); try { $this->cache = new RedisCache($host, $configMock); } catch (\Exception $e) { $this->markTestSkipped('Redis is not available.'); } return $this->cache; } public function tearDown() { $this->cache->clear(false); parent::tearDown(); } }