/** * @test * @expectedException \TYPO3\Flow\Cache\Exception */ public function setCacheThrowsExceptionOnNonWritableDirectory() { $this->mockEnvironment = $this->getMockBuilder(\TYPO3\Flow\Utility\Environment::class)->disableOriginalConstructor()->getMock(); $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(1024)); $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://non/existing/directory')); $this->getSimpleFileBackend(); }
/** * 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)); }
public function setUp() { $this->mockDirectory = vfsStream::setup('WritableFileSystemStorageTest'); $this->writableFileSystemStorage = $this->getAccessibleMock(WritableFileSystemStorage::class, null, ['testStorage', ['path' => 'vfs://WritableFileSystemStorageTest/']]); $this->mockEnvironment = $this->getMockBuilder(Environment::class)->disableOriginalConstructor()->getMock(); $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://WritableFileSystemStorageTest/')); $this->inject($this->writableFileSystemStorage, 'environment', $this->mockEnvironment); }
/** * 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::class, 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::class, array('registerCache'), array(), '', FALSE); $this->mockCacheManager->expects($this->any())->method('isCachePersistent')->will($this->returnValue(FALSE)); }
public function setUp() { vfsStream::setup('Foo'); $this->cacheManager = new \TYPO3\Flow\Cache\CacheManager(); $this->mockEnvironment = $this->getMockBuilder(\TYPO3\Flow\Utility\Environment::class)->disableOriginalConstructor()->getMock(); $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/')); $this->cacheManager->injectEnvironment($this->mockEnvironment); $this->mockSystemLogger = $this->getMock(\TYPO3\Flow\Log\SystemLoggerInterface::class); $this->cacheManager->injectSystemLogger($this->mockSystemLogger); $this->mockConfigurationManager = $this->getMockBuilder(\TYPO3\Flow\Configuration\ConfigurationManager::class)->disableOriginalConstructor()->getMock(); $this->cacheManager->injectConfigurationManager($this->mockConfigurationManager); }
/** * @test * @expectedException \TYPO3\Flow\Cache\Exception */ public function setCacheThrowsExceptionIfCachePathLengthExceedsMaximumPathLength() { $this->mockEnvironment = $this->getMockBuilder('TYPO3\\Flow\\Utility\\Environment')->disableOriginalConstructor()->getMock(); $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(5)); $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Temporary/Directory/')); $this->getSimpleFileBackend(); }