/**
  * @test
  */
 public function wrapContentPropertyDoesNotAddEditingMetaDataIfEditNodePrivilegeIsNotGranted()
 {
     $this->mockContentContext->expects($this->atLeastOnce())->method('getWorkspaceName')->will($this->returnValue('not-live'));
     $this->mockPrivilegeManager->expects($this->atLeastOnce())->method('isPrivilegeTargetGranted')->with('TYPO3.Neos:Backend.GeneralAccess')->will($this->returnValue(true));
     $this->mockNodeAuthorizationService->expects($this->atLeastOnce())->method('isGrantedToEditNode')->will($this->returnValue(false));
     $this->mockHtmlAugmenter->expects($this->never())->method('addAttributes');
     $this->contentElementEditableService->wrapContentProperty($this->mockNode, 'someProperty', '<div>someRenderedPropertyValue</div>');
 }
 /**
  * @test
  */
 public function renderDoesNotAddEditingMetaDataIfEditNodePrivilegeIsNotGranted()
 {
     $this->templateVariables = array('someProperty' => 'somePropertyValue');
     $this->mockContentContext->expects($this->atLeastOnce())->method('getWorkspaceName')->will($this->returnValue('not-live'));
     $this->mockPrivilegeManager->expects($this->atLeastOnce())->method('isPrivilegeTargetGranted')->with('TYPO3.Neos:Backend.GeneralAccess')->will($this->returnValue(true));
     $this->mockNodeAuthorizationService->expects($this->atLeastOnce())->method('isGrantedToEditNode')->will($this->returnValue(false));
     $this->tagBuilder->expects($this->never())->method('addAttribute');
     $this->injectDependenciesIntoViewHelper($this->editableViewHelper);
     $this->injectTypoScriptObject();
     $this->editableViewHelper->render('someProperty');
 }
 /**
  * Sets up a view with context for testing
  *
  * @return void
  */
 public function setUpMockView()
 {
     $this->mockContext = $this->getMockBuilder(ContentContext::class)->disableOriginalConstructor()->getMock();
     $mockNode = $this->getMockBuilder(NodeData::class)->disableOriginalConstructor()->getMock();
     $this->mockContextualizedNode = $this->getMockBuilder(Node::class)->setMethods(array('getContext'))->setConstructorArgs(array($mockNode, $this->mockContext))->getMock();
     $mockSiteNode = $this->createMock(NodeInterface::class);
     $this->mockContext->expects($this->any())->method('getCurrentSiteNode')->will($this->returnValue($mockSiteNode));
     $this->mockContext->expects($this->any())->method('getDimensions')->will($this->returnValue(array()));
     $this->mockContextualizedNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContext));
     $this->mockRuntime = $this->getMockBuilder(Runtime::class)->disableOriginalConstructor()->getMock();
     $mockControllerContext = $this->getMockBuilder(ControllerContext::class)->disableOriginalConstructor()->getMock();
     $this->mockSecurityContext = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
     $mockTypoScriptService = $this->createMock(TypoScriptService::class);
     $mockTypoScriptService->expects($this->any())->method('createRuntime')->will($this->returnValue($this->mockRuntime));
     $this->mockView = $this->getAccessibleMock(TypoScriptView::class, array('getClosestDocumentNode'));
     $this->mockView->expects($this->any())->method('getClosestDocumentNode')->will($this->returnValue($this->mockContextualizedNode));
     $this->inject($this->mockView, 'controllerContext', $mockControllerContext);
     $this->inject($this->mockView, 'securityContext', $this->mockSecurityContext);
     $this->inject($this->mockView, 'typoScriptService', $mockTypoScriptService);
     $this->mockView->_set('variables', array('value' => $this->mockContextualizedNode));
 }
 /**
  * Sets up a view with context for testing
  *
  * @return void
  */
 public function setUpMockView()
 {
     $this->mockContext = $this->getMock('TYPO3\\Neos\\Domain\\Service\\ContentContext', array(), array(), '', FALSE);
     $mockNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData', array(), array(), '', FALSE);
     $this->mockContextualizedNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\Node', NULL, array($mockNode, $this->mockContext));
     $mockSiteNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface');
     $this->mockContext->expects($this->any())->method('getCurrentSiteNode')->will($this->returnValue($mockSiteNode));
     $this->mockContext->expects($this->any())->method('getDimensions')->will($this->returnValue(array()));
     $this->mockContextualizedNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContext));
     $this->mockRuntime = $this->getMock('TYPO3\\TypoScript\\Core\\Runtime', array(), array(), '', FALSE);
     $mockControllerContext = $this->getMock('TYPO3\\Flow\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE);
     $this->mockSecurityContext = $this->getMock('TYPO3\\Flow\\Security\\Context', array(), array(), '', FALSE);
     $mockTypoScriptService = $this->getMock('TYPO3\\Neos\\Domain\\Service\\TypoScriptService');
     $mockTypoScriptService->expects($this->any())->method('createRuntime')->will($this->returnValue($this->mockRuntime));
     $this->mockView = $this->getAccessibleMock('TYPO3\\Neos\\View\\TypoScriptView', array('getClosestDocumentNode'));
     $this->mockView->expects($this->any())->method('getClosestDocumentNode')->will($this->returnValue($this->mockContextualizedNode));
     $this->inject($this->mockView, 'controllerContext', $mockControllerContext);
     $this->inject($this->mockView, 'securityContext', $this->mockSecurityContext);
     $this->inject($this->mockView, 'typoScriptService', $mockTypoScriptService);
     $this->mockView->_set('variables', array('value' => $this->mockContextualizedNode));
 }