public function setUp() { \vfsStreamWrapper::register(); \vfsStreamWrapper::setRoot(new \vfsStreamDirectory('testDirectory')); $this->view = $this->getMock('TYPO3\\FLOW3\\Mvc\\View\\NotFoundView', array('getTemplatePathAndFilename')); $httpRequest = \TYPO3\FLOW3\Http\Request::create(new \TYPO3\FLOW3\Http\Uri('http://typo3.org')); $this->request = $httpRequest->createActionRequest(); $this->response = new \TYPO3\FLOW3\Http\Response(); $this->controllerContext = $this->getMock('TYPO3\\FLOW3\\Mvc\\Controller\\ControllerContext', array('getRequest', 'getResponse'), array(), '', FALSE); $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request)); $this->controllerContext->expects($this->any())->method('getResponse')->will($this->returnValue($this->response)); $this->view->setControllerContext($this->controllerContext); }
/** * Processes a generic request and fills the response with the default view * * @param \TYPO3\FLOW3\Mvc\RequestInterface $request The request object * @param \TYPO3\FLOW3\Mvc\ResponseInterface $response The response, modified by this handler * @return void * @api */ public function processRequest(\TYPO3\FLOW3\Mvc\RequestInterface $request, \TYPO3\FLOW3\Mvc\ResponseInterface $response) { $this->initializeController($request, $response); $this->notFoundView->setControllerContext($this->controllerContext); if ($this->exception !== NULL) { $this->notFoundView->assign('errorMessage', $this->exception->getMessage()); } switch (get_class($request)) { case 'TYPO3\\FLOW3\\Mvc\\ActionRequest': $response->setStatus(404); $response->setContent($this->notFoundView->render()); break; default: $response->setContent("\nUnknown command\n\n"); } }