public function setUp() { $this->siteNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface'); $this->firstLevelNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface'); $this->secondLevelNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface'); $this->siteNode->expects($this->any())->method('getPath')->will($this->returnValue('/site')); $this->siteNode->expects($this->any())->method('getChildNodes')->will($this->returnValue(array($this->firstLevelNode))); $this->mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock(); $this->firstLevelNode->expects($this->any())->method('getParent')->will($this->returnValue($this->siteNode)); $this->firstLevelNode->expects($this->any())->method('getPath')->will($this->returnValue('/site/first')); $this->secondLevelNode->expects($this->any())->method('getParent')->will($this->returnValue($this->siteNode)); $this->secondLevelNode->expects($this->any())->method('getPath')->will($this->returnValue('/site/first/second')); }
public function setUp() { $this->convertEmailLinks = $this->getAccessibleMock('Networkteam\\Neos\\MailObfuscator\\Typoscript\\ConvertEmailLinksImplementation', array('getValue'), array(), '', FALSE); $this->mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock(); $this->mockContext->expects($this->any())->method('getWorkspaceName')->will($this->returnValue('live')); $this->mockNode = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->getMock(); $this->mockNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContext)); $this->mockTsRuntime = $this->getMockBuilder('TYPO3\\TypoScript\\Core\\Runtime')->disableOriginalConstructor()->getMock(); $this->mockTsRuntime->expects($this->any())->method('getCurrentContext')->will($this->returnValue(array('node' => $this->mockNode))); $this->convertEmailLinks->_set('tsRuntime', $this->mockTsRuntime); $this->convertEmailLinks->_set('linkNameConverter', new \Networkteam\Neos\MailObfuscator\String\Converter\RewriteAtCharConverter()); $this->convertEmailLinks->_set('mailToHrefConverter', new \Networkteam\Neos\MailObfuscator\String\Converter\Mailto2HrefObfuscatingConverter()); srand(10); }
public function setUp() { $this->siteNode = $this->createMock(NodeInterface::class); $this->firstNodeInLevel = $this->createMock(NodeInterface::class); $this->secondNodeInLevel = $this->createMock(NodeInterface::class); $this->thirdNodeInLevel = $this->createMock(NodeInterface::class); $this->siteNode->expects($this->any())->method('getPath')->will($this->returnValue('/site')); $this->siteNode->expects($this->any())->method('getChildNodes')->will($this->returnValue(array($this->firstNodeInLevel, $this->secondNodeInLevel, $this->thirdNodeInLevel))); $this->mockContext = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(); $this->firstNodeInLevel->expects($this->any())->method('getParent')->will($this->returnValue($this->siteNode)); $this->firstNodeInLevel->expects($this->any())->method('getPath')->will($this->returnValue('/site/first')); $this->secondNodeInLevel->expects($this->any())->method('getParent')->will($this->returnValue($this->siteNode)); $this->secondNodeInLevel->expects($this->any())->method('getPath')->will($this->returnValue('/site/second')); $this->thirdNodeInLevel->expects($this->any())->method('getParent')->will($this->returnValue($this->siteNode)); $this->thirdNodeInLevel->expects($this->any())->method('getPath')->will($this->returnValue('/site/third')); }
protected function setUp() { $this->service = new CacheControlService(); $this->mockContentCacheAspect = $this->getMock('MOC\\Varnish\\Aspects\\ContentCacheAspect'); $this->inject($this->service, 'contentCacheAspect', $this->mockContentCacheAspect); $this->mockLogger = $this->getMockBuilder('MOC\\Varnish\\Log\\LoggerInterface')->getMock(); $this->inject($this->service, 'logger', $this->mockLogger); $this->contentCacheFrontend = new MetadataAwareStringFrontend('test', new TransientMemoryBackend(new ApplicationContext('Testing'))); $this->contentCacheFrontend->initializeObject(); $this->inject($this->service, 'contentCacheFrontend', $this->contentCacheFrontend); $this->mockTokenStorage = $this->getMock('MOC\\Varnish\\Service\\TokenStorage'); $this->inject($this->service, 'tokenStorage', $this->mockTokenStorage); $this->mockRequest = $this->getMock('TYPO3\\Flow\\Mvc\\RequestInterface'); $this->mockResponse = $this->getMock('TYPO3\\Flow\\Http\\Response'); $this->mockController = $this->getMock('TYPO3\\Neos\\Controller\\Frontend\\NodeController'); $this->mockControllerContext = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Controller\\ControllerContext')->disableOriginalConstructor()->getMock(); $this->mockController->expects($this->any())->method('getControllerContext')->willReturn($this->mockControllerContext); $this->mockArguments = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Controller\\Arguments')->getMock(); $this->mockControllerContext->expects($this->any())->method('getArguments')->willReturn($this->mockArguments); $this->mockArguments->expects($this->any())->method('hasArgument')->with('node')->willReturn(TRUE); $this->mockArgument = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Controller\\Argument')->disableOriginalConstructor()->getMock(); $this->mockArguments->expects($this->any())->method('getArgument')->with('node')->willReturn($this->mockArgument); $this->mockNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface'); $this->mockArgument->expects($this->any())->method('getValue')->willReturn($this->mockNode); $this->mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock(); $this->mockNode->expects($this->any())->method('getContext')->willReturn($this->mockContext); }
public function setUp() { parent::setUp(); $this->contentElementEditableService = new ContentElementEditableService(); $this->mockPrivilegeManager = $this->getMockBuilder(PrivilegeManagerInterface::class)->getMock(); $this->inject($this->contentElementEditableService, 'privilegeManager', $this->mockPrivilegeManager); $this->mockNodeAuthorizationService = $this->getMockBuilder(AuthorizationService::class)->getMock(); $this->inject($this->contentElementEditableService, 'nodeAuthorizationService', $this->mockNodeAuthorizationService); $this->mockHtmlAugmenter = $this->getMockBuilder(HtmlAugmenter::class)->getMock(); $this->inject($this->contentElementEditableService, 'htmlAugmenter', $this->mockHtmlAugmenter); $this->mockTsRuntime = $this->getMockBuilder('TYPO3\\TypoScript\\Core\\Runtime')->disableOriginalConstructor()->getMock(); $this->mockContentContext = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Service\\ContentContext')->disableOriginalConstructor()->getMock(); $this->mockNode = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->getMock(); $this->mockNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContentContext)); $this->mockNode->expects($this->any())->method('getNodeType')->will($this->returnValue(new NodeType('Acme.Test:Headline', [], []))); $this->mockTsContext = array('node' => $this->mockNode); $this->mockTsRuntime->expects($this->any())->method('getCurrentContext')->will($this->returnValue($this->mockTsContext)); }
public function setUp() { parent::setUp(); $this->editableViewHelper = $this->getAccessibleMock('TYPO3\\Neos\\ViewHelpers\\ContentElement\\EditableViewHelper', array('renderChildren')); $this->mockPrivilegeManager = $this->getMockBuilder('TYPO3\\Flow\\Security\\Authorization\\PrivilegeManagerInterface')->getMock(); $this->inject($this->editableViewHelper, 'privilegeManager', $this->mockPrivilegeManager); $this->mockNodeAuthorizationService = $this->getMockBuilder(AuthorizationService::class)->getMock(); $this->inject($this->editableViewHelper, 'nodeAuthorizationService', $this->mockNodeAuthorizationService); $this->mockTemplateImplementation = $this->getMockBuilder('TYPO3\\TypoScript\\TypoScriptObjects\\TemplateImplementation')->disableOriginalConstructor()->getMock(); $this->mockTsRuntime = $this->getMockBuilder('TYPO3\\TypoScript\\Core\\Runtime')->disableOriginalConstructor()->getMock(); $this->mockContentContext = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Service\\ContentContext')->disableOriginalConstructor()->getMock(); $this->mockNode = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->getMock(); $this->mockNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContentContext)); $this->mockTsContext = array('node' => $this->mockNode); $this->mockTsRuntime->expects($this->any())->method('getCurrentContext')->will($this->returnValue($this->mockTsContext)); $this->mockTemplateImplementation->expects($this->any())->method('getTsRuntime')->will($this->returnValue($this->mockTsRuntime)); $this->mockView = $this->getAccessibleMock('TYPO3\\TypoScript\\TypoScriptObjects\\Helpers\\FluidView', array(), array(), '', FALSE); $this->mockView->expects($this->any())->method('getTypoScriptObject')->will($this->returnValue($this->mockTemplateImplementation)); $this->editableViewHelper->initializeArguments(); }
public function setUp() { $this->convertUrisImplementation = $this->getAccessibleMock('TYPO3\\Neos\\TypoScript\\ConvertUrisImplementation', array('tsValue'), array(), '', false); $this->mockWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock(); $this->mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock(); $this->mockContext->expects($this->any())->method('getWorkspace')->will($this->returnValue($this->mockWorkspace)); $this->mockNode = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->getMock(); $this->mockNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContext)); $this->mockHttpUri = $this->getMockBuilder('TYPO3\\Flow\\Http\\Uri')->disableOriginalConstructor()->getMock(); $this->mockHttpUri->expects($this->any())->method('getHost')->will($this->returnValue('localhost')); $this->mockHttpRequest = $this->getMockBuilder('TYPO3\\Flow\\Http\\Request')->disableOriginalConstructor()->getMock(); $this->mockHttpRequest->expects($this->any())->method('getUri')->will($this->returnValue($this->mockHttpUri)); $this->mockActionRequest = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\ActionRequest')->disableOriginalConstructor()->getMock(); $this->mockActionRequest->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->mockHttpRequest)); $this->mockControllerContext = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Controller\\ControllerContext')->disableOriginalConstructor()->getMock(); $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockActionRequest)); $this->mockLinkingService = $this->createMock('TYPO3\\Neos\\Service\\LinkingService'); $this->convertUrisImplementation->_set('linkingService', $this->mockLinkingService); $this->mockTsRuntime = $this->getMockBuilder('TYPO3\\TypoScript\\Core\\Runtime')->disableOriginalConstructor()->getMock(); $this->mockTsRuntime->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext)); $this->convertUrisImplementation->_set('tsRuntime', $this->mockTsRuntime); }
public function setUp() { $this->convertUrisImplementation = $this->getAccessibleMock(ConvertUrisImplementation::class, array('tsValue'), array(), '', false); $this->mockWorkspace = $this->getMockBuilder(Workspace::class)->disableOriginalConstructor()->getMock(); $this->mockContext = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(); $this->mockContext->expects($this->any())->method('getWorkspace')->will($this->returnValue($this->mockWorkspace)); $this->mockNode = $this->getMockBuilder(NodeInterface::class)->getMock(); $this->mockNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContext)); $this->mockHttpUri = $this->getMockBuilder(Uri::class)->disableOriginalConstructor()->getMock(); $this->mockHttpUri->expects($this->any())->method('getHost')->will($this->returnValue('localhost')); $this->mockHttpRequest = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock(); $this->mockHttpRequest->expects($this->any())->method('getUri')->will($this->returnValue($this->mockHttpUri)); $this->mockActionRequest = $this->getMockBuilder(ActionRequest::class)->disableOriginalConstructor()->getMock(); $this->mockActionRequest->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->mockHttpRequest)); $this->mockControllerContext = $this->getMockBuilder(ControllerContext::class)->disableOriginalConstructor()->getMock(); $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockActionRequest)); $this->mockLinkingService = $this->createMock(LinkingService::class); $this->convertUrisImplementation->_set('linkingService', $this->mockLinkingService); $this->mockTsRuntime = $this->getMockBuilder(Runtime::class)->disableOriginalConstructor()->getMock(); $this->mockTsRuntime->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext)); $this->convertUrisImplementation->_set('tsRuntime', $this->mockTsRuntime); }
public function setUp() { parent::setUp(); $this->editableViewHelper = $this->getAccessibleMock(EditableViewHelper::class, array('renderChildren')); $this->mockPrivilegeManager = $this->getMockBuilder(PrivilegeManagerInterface::class)->getMock(); $this->inject($this->editableViewHelper, 'privilegeManager', $this->mockPrivilegeManager); $this->mockNodeAuthorizationService = $this->getMockBuilder(AuthorizationService::class)->getMock(); $this->inject($this->editableViewHelper, 'nodeAuthorizationService', $this->mockNodeAuthorizationService); $this->mockContentElementEditableService = $this->getMockBuilder(ContentElementEditableService::class)->getMock(); $this->inject($this->editableViewHelper, 'contentElementEditableService', $this->mockContentElementEditableService); $this->mockTemplateImplementation = $this->getMockBuilder(TemplateImplementation::class)->disableOriginalConstructor()->getMock(); $this->mockTsRuntime = $this->getMockBuilder(Runtime::class)->disableOriginalConstructor()->getMock(); $this->mockContentContext = $this->getMockBuilder(ContentContext::class)->disableOriginalConstructor()->getMock(); $this->mockNode = $this->getMockBuilder(NodeInterface::class)->getMock(); $this->mockNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContentContext)); $this->mockNode->expects($this->any())->method('getNodeType')->will($this->returnValue(new NodeType('Acme.Test:Headline', [], []))); $this->mockTsContext = array('node' => $this->mockNode); $this->mockTsRuntime->expects($this->any())->method('getCurrentContext')->will($this->returnValue($this->mockTsContext)); $this->mockTemplateImplementation->expects($this->any())->method('getTsRuntime')->will($this->returnValue($this->mockTsRuntime)); $this->mockView = $this->getAccessibleMock(FluidView::class, array(), array(), '', false); $this->mockView->expects($this->any())->method('getTypoScriptObject')->will($this->returnValue($this->mockTemplateImplementation)); $this->editableViewHelper->initializeArguments(); }
/** * @param NodeInterface $mockNode * @param array $nodeContextProperties * @return FlowQuery */ protected function buildFlowQueryWithNodeInContext($mockNode, $nodeContextProperties) { $mockNodeContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock(); $mockNodeContext->expects($this->any())->method('getProperties')->will($this->returnValue($nodeContextProperties)); $mockNode->expects($this->any())->method('getContext')->will($this->returnValue($mockNodeContext)); $mockFlowQuery = $this->getMockBuilder('TYPO3\\Eel\\FlowQuery\\FlowQuery')->disableOriginalConstructor()->getMock(); $mockFlowQuery->expects($this->any())->method('getContext')->will($this->returnValue(array($mockNode))); return $mockFlowQuery; }
/** * @param NodeInterface $mockNode * @param array $nodeContextProperties * @return FlowQuery */ protected function buildFlowQueryWithNodeInContext($mockNode, $nodeContextProperties) { $mockNodeContext = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(); $mockNodeContext->expects($this->any())->method('getProperties')->will($this->returnValue($nodeContextProperties)); $mockNode->expects($this->any())->method('getContext')->will($this->returnValue($mockNodeContext)); $mockFlowQuery = $this->getMockBuilder(FlowQuery::class)->disableOriginalConstructor()->getMock(); $mockFlowQuery->expects($this->any())->method('getContext')->will($this->returnValue(array($mockNode))); return $mockFlowQuery; }