/** * @test * @requires extension igbinary */ public function getUsesIgBinaryIfAvailable() { $theArray = array('Just some value', 'and another one.'); $backend = $this->getMock(\TYPO3\Flow\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false); $backend->expects($this->once())->method('get')->will($this->returnValue(igbinary_serialize($theArray))); $cache = new \TYPO3\Flow\Cache\Frontend\VariableFrontend('VariableFrontend', $backend); $cache->initializeObject(); $this->assertEquals($theArray, $cache->get('VariableCacheTest'), 'The returned value was not the expected unserialized array.'); }
/** * @test */ public function getUsesIgBinaryIfAvailable() { if (!extension_loaded('igbinary')) { $this->markTestSkipped('Cannot test igbinary support, because igbinary is not installed.'); } $theArray = array('Just some value', 'and another one.'); $backend = $this->getMock('TYPO3\\Flow\\Cache\\Backend\\AbstractBackend', array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', FALSE); $backend->expects($this->once())->method('get')->will($this->returnValue(igbinary_serialize($theArray))); $cache = new \TYPO3\Flow\Cache\Frontend\VariableFrontend('VariableFrontend', $backend); $cache->initializeObject(); $this->assertEquals($theArray, $cache->get('VariableCacheTest'), 'The returned value was not the expected unserialized array.'); }