shouldReceive('get') ->with('system', 'redis_host') ->andReturn($host); $configMock ->shouldReceive('get') ->with('system', 'redis_port') ->andReturn($port); $configMock ->shouldReceive('get') ->with('system', 'redis_db', 0) ->andReturn(0); $configMock ->shouldReceive('get') ->with('system', 'redis_password') ->andReturn(null); try { $this->cache = new RedisCache($host, $configMock); $this->lock = new CacheLock($this->cache); } catch (Exception $e) { static::markTestSkipped('Redis is not available. Error: ' . $e->getMessage()); } parent::setUp(); } protected function getInstance(): CAcheLock { return $this->lock; } protected function getCache(): ICanCacheInMemory { return $this->cache; } }