shouldReceive('get') ->with('system', 'memcache_host') ->andReturn($host); $configMock ->shouldReceive('get') ->with('system', 'memcache_port') ->andReturn(11211); $lock = null; try { $cache = new MemcacheCache($host, $configMock); $lock = new CacheLock($cache); } catch (\Exception $e) { $this->markTestSkipped('Memcache is not available'); } return $lock; } }