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->createMock(Utility\Environment::class); $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/')); $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(1024)); $this->mockEnvironment->expects($this->any())->method('getContext')->will($this->returnValue(new ApplicationContext('Testing'))); $this->mockCacheManager = $this->getMockBuilder(CacheManager::class)->setMethods(['registerCache', 'isCachePersistent'])->disableOriginalConstructor()->getMock(); $this->mockCacheManager->expects($this->any())->method('isCachePersistent')->will($this->returnValue(false)); $this->mockEnvironmentConfiguration = $this->getMockBuilder(EnvironmentConfiguration::class)->setConstructorArgs([__DIR__ . '~Testing', 'vfs://Foo/', 255])->getMock(); }
public function setUp() { vfsStream::setup('Foo'); $this->cacheManager = new CacheManager(); $this->mockEnvironment = $this->getMockBuilder(Environment::class)->disableOriginalConstructor()->getMock(); $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/')); $this->cacheManager->injectEnvironment($this->mockEnvironment); $this->mockSystemLogger = $this->createMock(SystemLoggerInterface::class); $this->cacheManager->injectSystemLogger($this->mockSystemLogger); $this->mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock(); $this->cacheManager->injectConfigurationManager($this->mockConfigurationManager); }