/**
  * Creates the mocked filesystem used in the tests
  */
 public function setUp()
 {
     vfsStream::setup('Foo');
     $this->mockEnvironment = $this->getMockBuilder(\TYPO3\Flow\Utility\Environment::class)->disableOriginalConstructor()->getMock();
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/'));
     $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(1024));
     $this->mockCacheManager = $this->getMockBuilder(\TYPO3\Flow\Cache\CacheManager::class)->disableOriginalConstructor()->setMethods(array('registerCache', 'isCachePersistent'))->getMock();
     $this->mockCacheManager->expects($this->any())->method('isCachePersistent')->will($this->returnValue(false));
 }
 /**
  * Creates the mocked filesystem used in the tests
  */
 public function setUp()
 {
     vfsStream::setup('Foo');
     $this->mockEnvironment = $this->getMock('TYPO3\\Flow\\Utility\\Environment', array(), array(), '', FALSE);
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/'));
     $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(1024));
     $this->mockCacheManager = $this->getMock('TYPO3\\Flow\\Cache\\CacheManager', array('registerCache'), array(), '', FALSE);
     $this->mockCacheManager->expects($this->any())->method('isCachePersistent')->will($this->returnValue(FALSE));
 }
 /**
  * @test
  */
 public function aDifferentDefaultCacheDirectoryIsUsedForPersistentCaches()
 {
     $this->mockCacheManager->expects($this->atLeastOnce())->method('isCachePersistent')->will($this->returnValue(true));
     $this->mockCacheFrontend->expects($this->any())->method('getIdentifier')->will($this->returnValue('SomeCache'));
     // We need to create the directory here because vfs doesn't support touch() which is used by
     // createDirectoryRecursively() in the setCache method.
     mkdir('vfs://Temporary/Directory/Cache');
     $simpleFileBackend = $this->getSimpleFileBackend();
     $this->assertEquals(FLOW_PATH_DATA . 'Persistent/Cache/Data/SomeCache/', $simpleFileBackend->getCacheDirectory());
 }