/** * Sets up the test case * * @author Bastian Waidelich <*****@*****.**> */ public function setUp() { $this->router = $this->getMock('F3\\FLOW3\\MVC\\Web\\Routing\\RouterInterface'); $this->request = $this->getMock('F3\\FLOW3\\MVC\\Web\\Request'); $environment = $this->getMock('F3\\FLOW3\\Utility\\Environment', array('isRewriteEnabled'), array(), '', FALSE); $environment->expects($this->any())->method('isRewriteEnabled')->will($this->returnValue(1)); $this->uriBuilder = $this->getMock($this->buildAccessibleProxy('F3\\FLOW3\\MVC\\Web\\Routing\\UriBuilder'), array('dummy')); $this->uriBuilder->injectRouter($this->router); $this->uriBuilder->injectEnvironment($environment); $this->uriBuilder->setRequest($this->request); }
/** * Processes a general request. The result can be returned by altering the given response. * * @param \F3\FLOW3\MVC\RequestInterface $request The request object * @param \F3\FLOW3\MVC\ResponseInterface $response The response, modified by this handler * @return void * @throws \F3\FLOW3\MVC\Exception\UnsupportedRequestTypeException if the controller doesn't support the current request type * @author Robert Lemke <*****@*****.**> * @api */ public function processRequest(\F3\FLOW3\MVC\RequestInterface $request, \F3\FLOW3\MVC\ResponseInterface $response) { if (!$this->canProcessRequest($request)) { throw new \F3\FLOW3\MVC\Exception\UnsupportedRequestTypeException(get_class($this) . ' does not support requests of type "' . get_class($request) . '". Supported types are: ' . implode(' ', $this->supportedRequestTypes), 1187701131); } $this->request = $request; $this->request->setDispatched(TRUE); $this->response = $response; $this->uriBuilder = $this->objectFactory->create('F3\\FLOW3\\MVC\\Web\\Routing\\UriBuilder'); $this->uriBuilder->setRequest($request); $this->initializeControllerArgumentsBaseValidators(); $this->mapRequestArgumentsToControllerArguments(); $this->controllerContext = $this->objectFactory->create('F3\\FLOW3\\MVC\\Controller\\Context', $this->request, $this->response, $this->arguments, $this->argumentsMappingResults, $this->uriBuilder, $this->flashMessageContainer); }