/** * @test * @author Bastian Waidelich <*****@*****.**> */ public function resetSetsAllOptionsToTheirDefaultValue() { $this->uriBuilder->setArguments(array('test' => 'arguments'))->setSection('testSection')->setFormat('someFormat')->setCreateAbsoluteUri(TRUE)->setAddQueryString(TRUE)->setArgumentsToBeExcludedFromQueryString(array('test' => 'addQueryStringExcludeArguments')); $this->uriBuilder->reset(); $this->assertEquals(array(), $this->uriBuilder->getArguments()); $this->assertEquals('', $this->uriBuilder->getSection()); $this->assertEquals('', $this->uriBuilder->getFormat()); $this->assertEquals(FALSE, $this->uriBuilder->getCreateAbsoluteUri()); $this->assertEquals(FALSE, $this->uriBuilder->getAddQueryString()); $this->assertEquals(array(), $this->uriBuilder->getArgumentsToBeExcludedFromQueryString()); }
/** * Forwards the request to another action and / or controller. * * NOTE: This method only supports web requests and will throw an exception * if used with other request types. * * @param string $actionName Name of the action to forward to * @param string $controllerName Unqualified object name of the controller to forward to. If not specified, the current controller is used. * @param string $packageKey Key of the package containing the controller to forward to. If not specified, the current package is assumed. * @param array $arguments Array of arguments for the target action * @param integer $delay (optional) The delay in seconds. Default is no delay. * @param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other" * @param \F3\FLOW3\MVC\Controller\Arguments $arguments Arguments to pass to the target action * @return void * @throws \F3\FLOW3\MVC\Exception\StopActionException * @author Karsten Dambekalns <*****@*****.**> * @api */ protected function redirect($actionName, $controllerName = NULL, $packageKey = NULL, array $arguments = NULL, $delay = 0, $statusCode = 303) { if (!$this->request instanceof \F3\FLOW3\MVC\Web\Request) { throw new \F3\FLOW3\MVC\Exception\UnsupportedRequestTypeException('redirect() only supports web requests.', 1238101344); } if ($packageKey !== NULL && strpos($packageKey, '\\') !== FALSE) { list($packageKey, $subpackageKey) = explode('\\', $packageKey, 2); } else { $subpackageKey = NULL; } $uri = $this->uriBuilder->reset()->uriFor($actionName, $arguments, $controllerName, $packageKey, $subpackageKey); $this->redirectToUri($uri, $delay, $statusCode); }
/** * @return void * @author Sebastian Kurfürst <*****@*****.**> */ public function setUp() { $this->viewHelperVariableContainer = $this->getMock('F3\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer'); $this->templateVariableContainer = $this->getMock('F3\\Fluid\\Core\\ViewHelper\\TemplateVariableContainer'); $this->uriBuilder = $this->getMock('F3\\FLOW3\\MVC\\Web\\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 $this->request = $this->getMock('F3\\FLOW3\\MVC\\Web\\Request'); $this->controllerContext = $this->getMock('F3\\FLOW3\\MVC\\Controller\\Context', 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('F3\\Fluid\\Core\\ViewHelper\\TagBuilder'); $this->arguments = $this->getMock('F3\\Fluid\\Core\\ViewHelper\\Arguments', array(), array(), '', FALSE); }