public function setUp() { $this->nodeTypeManager = new NodeTypeManager(); $this->mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock(); $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->with('NodeTypes')->will($this->returnValue($this->nodeTypesFixture)); $this->inject($this->nodeTypeManager, 'configurationManager', $this->mockConfigurationManager); }
/** * @test */ public function handleStoresRouterMatchResultsInTheComponentContext() { $mockMatchResults = array('someRouterMatchResults'); $this->mockConfigurationManager->expects($this->atLeastOnce())->method('getConfiguration')->will($this->returnValue(array())); $this->mockRouter->expects($this->atLeastOnce())->method('route')->with($this->mockHttpRequest)->will($this->returnValue($mockMatchResults)); $this->mockComponentContext->expects($this->atLeastOnce())->method('setParameter')->with('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'matchResults', $mockMatchResults); $this->routingComponent->handle($this->mockComponentContext); }
public function setUp($nodeTypesFixture = NULL) { if ($nodeTypesFixture === NULL) { $nodeTypesFixture = $this->nodeTypesFixture; } $this->configurationManager = $this->getMockBuilder('TYPO3\\Flow\\Configuration\\ConfigurationManager')->disableOriginalConstructor()->getMock(); $this->configurationManager->expects($this->any())->method('getConfiguration')->with('NodeTypes')->will($this->returnValue($nodeTypesFixture)); }
/** * Prepares $this->nodeTypeManager with a fresh instance with all mocks and makes the given fixture data available as NodeTypes configuration * * @param array $nodeTypesFixtureData */ protected function prepareNodeTypeManager(array $nodeTypesFixtureData) { $this->nodeTypeManager = new NodeTypeManager(); $this->mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock(); $mockCache = $this->getMock(\TYPO3\Flow\Cache\Frontend\StringFrontend::class, [], [], '', false); $mockCache->expects($this->any())->method('get')->willReturn(null); $this->inject($this->nodeTypeManager, 'fullConfigurationCache', $mockCache); $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->with('NodeTypes')->will($this->returnValue($nodeTypesFixtureData)); $this->inject($this->nodeTypeManager, 'configurationManager', $this->mockConfigurationManager); }
public function setUp() { $this->policyService = new PolicyService(); $this->mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock(); $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->with(ConfigurationManager::CONFIGURATION_TYPE_POLICY)->will($this->returnCallback(function () { return $this->mockPolicyConfiguration; })); $this->inject($this->policyService, 'configurationManager', $this->mockConfigurationManager); $this->mockObjectManager = $this->getMockBuilder(ObjectManager::class)->disableOriginalConstructor()->getMock(); $this->inject($this->policyService, 'objectManager', $this->mockObjectManager); $this->mockPrivilege = $this->getAccessibleMock(AbstractPrivilege::class, ['matchesSubject'], [], '', false); }
/** * @test */ public function flushConfigurationCachesByChangedFilesFlushesConfigurationCache() { $this->registerCache('Flow_Object_Classes'); $this->registerCache('Flow_Object_Configuration'); $this->mockConfigurationManager->expects($this->once())->method('flushConfigurationCache'); $this->cacheManager->flushSystemCachesByChangedFiles('Flow_ConfigurationFiles', array()); }
/** * @test */ public function flushCachesCallsTheFlushConfigurationCacheMethodOfConfigurationManager() { $this->mockConfigurationManager->expects($this->once())->method('flushConfigurationCache'); $this->cacheManager->flushCaches(); }