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->mockContext->expects($this->any())->method('getCurrentSiteNode')->will($this->returnValue($this->siteNode));
     $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);
 }
 /**
  * @test
  */
 public function addHeadersInLiveWorkspaceAndCachedResponseAddsSiteToken()
 {
     $this->mockContext->expects($this->any())->method('getWorkspaceName')->willReturn('live');
     $this->mockTokenStorage->expects($this->any())->method('getToken')->willReturn('RandomSiteToken');
     $this->mockResponse->expects($this->at(0))->method('setHeader')->with('X-Site', 'RandomSiteToken');
     $this->service->addHeaders($this->mockRequest, $this->mockResponse, $this->mockController);
 }
 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);
 }