/**
  * @return void
  */
 public function setUp()
 {
     $this->viewHelperVariableContainer = $this->getMock('TYPO3\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer');
     $this->viewHelperVariableContainer->expects($this->any())->method('exists')->will($this->returnCallback(array($this, 'viewHelperVariableContainerExistsCallback')));
     $this->viewHelperVariableContainer->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'viewHelperVariableContainerGetCallback')));
     $this->templateVariableContainer = $this->getMock('TYPO3\\Fluid\\Core\\ViewHelper\\TemplateVariableContainer');
     $this->uriBuilder = $this->getMock('TYPO3\\Flow\\Mvc\\Routing\\UriBuilder');
     $this->uriBuilder->expects($this->any())->method('reset')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setArguments')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setSection')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setFormat')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setCreateAbsoluteUri')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setAddQueryString')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setArgumentsToBeExcludedFromQueryString')->will($this->returnValue($this->uriBuilder));
     // BACKPORTER TOKEN #1
     $httpRequest = \TYPO3\Flow\Http\Request::create(new \TYPO3\Flow\Http\Uri('http://localhost/foo'));
     $this->request = $this->getMock('TYPO3\\Flow\\Mvc\\ActionRequest', array(), array($httpRequest));
     $this->request->expects($this->any())->method('isMainRequest')->will($this->returnValue(TRUE));
     $this->controllerContext = $this->getMock('TYPO3\\Flow\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE);
     $this->controllerContext->expects($this->any())->method('getUriBuilder')->will($this->returnValue($this->uriBuilder));
     $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
     $this->tagBuilder = $this->getMock('TYPO3\\Fluid\\Core\\ViewHelper\\TagBuilder');
     $this->arguments = array();
     $this->renderingContext = new \TYPO3\Fluid\Core\Rendering\RenderingContext();
     $this->renderingContext->injectTemplateVariableContainer($this->templateVariableContainer);
     $this->renderingContext->injectViewHelperVariableContainer($this->viewHelperVariableContainer);
     $this->renderingContext->setControllerContext($this->controllerContext);
 }
 /**
  * Sets up this test case
  * @return void
  */
 public function setUp()
 {
     $this->view = $this->getMockBuilder(\TYPO3\Flow\Mvc\View\JsonView::class)->setMethods(array('loadConfigurationFromYamlFile'))->getMock();
     $this->controllerContext = $this->getMockBuilder(\TYPO3\Flow\Mvc\Controller\ControllerContext::class)->disableOriginalConstructor()->getMock();
     $this->response = $this->createMock(\TYPO3\Flow\Http\Response::class);
     $this->controllerContext->expects($this->any())->method('getResponse')->will($this->returnValue($this->response));
     $this->view->setControllerContext($this->controllerContext);
 }
 /**
  * Sets up this test case
  * @return void
  */
 public function setUp()
 {
     $this->view = $this->getMock('TYPO3\\Flow\\Mvc\\View\\JsonView', array('loadConfigurationFromYamlFile'));
     $this->controllerContext = $this->getMock('TYPO3\\Flow\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE);
     $this->response = $this->getMock('TYPO3\\Flow\\Http\\Response', array());
     $this->controllerContext->expects($this->any())->method('getResponse')->will($this->returnValue($this->response));
     $this->view->setControllerContext($this->controllerContext);
 }
 public function setUp()
 {
     $this->standaloneView = $this->getAccessibleMock(\TYPO3\Fluid\View\StandaloneView::class, array('dummy'));
     $this->mockRequest = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock();
     $this->mockControllerContext = $this->getMockBuilder(\TYPO3\Flow\Mvc\Controller\ControllerContext::class)->disableOriginalConstructor()->getMock();
     $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockRequest));
     $this->inject($this->standaloneView, 'controllerContext', $this->mockControllerContext);
 }
 /**
  * Sets up this test case
  * @return void
  */
 public function setUp()
 {
     $this->view = $this->getMock(\TYPO3\Flow\Mvc\View\JsonView::class, array('loadConfigurationFromYamlFile'));
     $this->controllerContext = $this->getMock(\TYPO3\Flow\Mvc\Controller\ControllerContext::class, array(), array(), '', false);
     $this->response = $this->getMock(\TYPO3\Flow\Http\Response::class, array());
     $this->controllerContext->expects($this->any())->method('getResponse')->will($this->returnValue($this->response));
     $this->view->setControllerContext($this->controllerContext);
 }
 /**
  * Prepare a TypoScriptView for testing that Mocks a request with the given controller and action names.
  *
  * @param string $controllerObjectName
  * @param string $controllerActionName
  * @return TypoScriptView
  */
 protected function buildView($controllerObjectName, $controllerActionName)
 {
     $request = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\ActionRequest')->disableOriginalConstructor()->getMock();
     $request->expects($this->any())->method('getControllerObjectName')->will($this->returnValue($controllerObjectName));
     $request->expects($this->any())->method('getControllerActionName')->will($this->returnValue($controllerActionName));
     $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($request));
     $view = new TypoScriptView();
     $view->setControllerContext($this->mockControllerContext);
     $this->inject($view, 'fallbackView', $this->mockFallbackView);
     $view->setTypoScriptPathPattern(__DIR__ . '/Fixtures/TypoScript');
     return $view;
 }
 public function setUp()
 {
     $this->mockTsRuntime = $this->getMockBuilder('TYPO3\\TypoScript\\Core\\Runtime')->disableOriginalConstructor()->getMock();
     $this->mockControllerContext = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Controller\\ControllerContext')->disableOriginalConstructor()->getMock();
     $this->mockActionRequest = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\ActionRequest')->disableOriginalConstructor()->getMock();
     $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockActionRequest));
     $this->mockTsRuntime->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext));
     $this->resourceUriImplementation = new ResourceUriImplementation($this->mockTsRuntime, 'resourceUri/test', 'TYPO3.TypoScript:ResourceUri');
     $this->mockResourceManager = $this->getMockBuilder('TYPO3\\Flow\\Resource\\ResourceManager')->disableOriginalConstructor()->getMock();
     $this->inject($this->resourceUriImplementation, 'resourceManager', $this->mockResourceManager);
     $this->mockI18nService = $this->getMockBuilder('TYPO3\\Flow\\I18n\\Service')->disableOriginalConstructor()->getMock();
     $this->inject($this->resourceUriImplementation, 'i18nService', $this->mockI18nService);
 }
示例#8
0
 /**
  * @test
  * @param string $requestUri
  * @param string $sectionArgument
  * @param string $expectedResult
  * @dataProvider getFormActionUriDataProvider
  */
 public function getFormActionUriTests($requestUri, $sectionArgument, $expectedResult)
 {
     $mockActionRequest = $this->getMockBuilder(ActionRequest::class)->disableOriginalConstructor()->getMock();
     $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($mockActionRequest));
     $mockHttpRequest = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
     $mockActionRequest->expects($this->any())->method('getHttpRequest')->will($this->returnValue($mockHttpRequest));
     $mockUri = $this->getMockBuilder(Uri::class)->disableOriginalConstructor()->getMock();
     $mockUri->expects($this->any())->method('__toString')->will($this->returnValue($requestUri));
     $mockHttpRequest->expects($this->any())->method('getUri')->will($this->returnValue($mockUri));
     $this->formViewHelper->expects($this->any())->method('hasArgument')->with('section')->will($this->returnValue($sectionArgument !== null));
     $this->formViewHelper->_set('arguments', ['section' => $sectionArgument]);
     $this->assertSame($expectedResult, $this->formViewHelper->_call('getFormActionUri'));
 }
 /**
  * Test if the response headers of the plugin - set within the plugin action / dispatch - were set into the parent response.
  *
  * @dataProvider responseHeadersDataprovider
  * @test
  */
 public function evaluateSetHeaderIntoParent($message, $input, $expected)
 {
     $this->pluginImplementation->expects($this->any())->method('buildPluginRequest')->will($this->returnValue($this->mockActionRequest));
     $parentResponse = new Response();
     $this->_setHeadersIntoResponse($parentResponse, $input['parent']);
     $this->mockControllerContext->expects($this->any())->method('getResponse')->will($this->returnValue($parentResponse));
     $this->mockDispatcher->expects($this->any())->method('dispatch')->will($this->returnCallback(function ($request, $response) use($input) {
         $this->_setHeadersIntoResponse($response, $input['plugin']);
     }));
     $this->pluginImplementation->evaluate();
     foreach ($expected as $expectedKey => $expectedValue) {
         $this->assertEquals($expectedValue, (string) $parentResponse->getHeaders()->get($expectedKey), $message);
     }
 }
 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()
 {
     $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);
 }