/** * Sets up the redis backend used for testing * * @param array $backendOptions Options for the memcache backend */ protected function setUpBackend(array $backendOptions = array()) { $mockCache = $this->getMock('TYPO3\\Flow\\Cache\\Frontend\\FrontendInterface', array(), array(), '', FALSE); $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('TestCache')); $this->backend = new \TYPO3\Flow\Cache\Backend\RedisBackend(new ApplicationContext('Testing'), $backendOptions); $this->backend->setCache($mockCache); $this->backend->initializeObject(); }
/** * Set up test case * @return void */ public function setUp() { $phpredisVersion = phpversion('redis'); if (version_compare($phpredisVersion, '1.2.0', '<')) { $this->markTestSkipped(sprintf('phpredis extension version %s is not supported. Please update to verson 1.2.0+.', $phpredisVersion)); } $this->redis = $this->getMockBuilder(\Redis::class)->disableOriginalConstructor()->getMock(); $this->cache = $this->getMock(\TYPO3\Flow\Cache\Frontend\FrontendInterface::class); $this->cache->expects($this->any())->method('getIdentifier')->will($this->returnValue('Foo_Cache')); $this->backend = new RedisBackend(new ApplicationContext('Development'), array(), $this->redis); $this->backend->setCache($this->cache); }
/** * Set up test case * @return void */ public function setUp() { $phpredisVersion = phpversion('redis'); if (version_compare($phpredisVersion, '1.2.0', '<')) { $this->markTestSkipped(sprintf('phpredis extension version %s is not supported. Please update to verson 1.2.0+.', $phpredisVersion)); } try { if (!@fsockopen('127.0.0.1', 6379)) { $this->markTestSkipped('redis server not reachable'); } } catch (\Exception $e) { $this->markTestSkipped('redis server not reachable'); } $this->backend = new RedisBackend(new ApplicationContext('Testing'), array('hostname' => '127.0.0.1', 'database' => 0)); $this->cache = $this->getMock(\TYPO3\Flow\Cache\Frontend\FrontendInterface::class); $this->cache->expects($this->any())->method('getIdentifier')->will($this->returnValue('TestCache')); $this->backend->setCache($this->cache); $this->backend->flush(); }