public function setUp()
 {
     $this->siteNode = $this->createMock(NodeInterface::class);
     $this->firstLevelNode = $this->createMock(NodeInterface::class);
     $this->secondLevelNode = $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->firstLevelNode)));
     $this->mockContext = $this->getMockBuilder(Context::class)->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()
 {
     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(\Neos\Fusion\Core\Runtime::class)->disableOriginalConstructor()->getMock();
     $this->mockContentContext = $this->getMockBuilder(\Neos\Neos\Domain\Service\ContentContext::class)->disableOriginalConstructor()->getMock();
     $this->mockNode = $this->getMockBuilder(\Neos\ContentRepository\Domain\Model\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));
 }
 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(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;
 }