/** * @test */ public function testGetCurrentConfigurationNameReturnsRequestParameterIfActionIsSave() { $request = new Request(); $request->setControllerActionName('save'); $request->setArguments(array('configurationName' => 'foobar')); $instance = $this->getMockForAbstractClass('FluidTYPO3\\Fluidbackend\\Controller\\AbstractBackendController'); $this->inject($instance, 'request', $request); $result = $this->callInaccessibleMethod($instance, 'getCurrentConfigurationName'); $this->assertEquals('foobar', $result); }
/** * Test for forwardIfFormParamsDoNotMatch() * * @param array $arguments * @param array $settings * @param bool $forwardActive * @return void * @dataProvider forwardIfFormParamsDoNotMatchReturnsVoidDataProvider * @test */ public function forwardIfFormParamsDoNotMatchReturnsVoid($arguments, $settings, $forwardActive) { $request = new Request(); $request->setArguments($arguments); $this->generalValidatorMock->_set('request', $request); $this->generalValidatorMock->_set('settings', $settings); try { // if forward() is called, an exception will be thrown $this->generalValidatorMock->_callRef('forwardIfFormParamsDoNotMatch'); } catch (\Exception $exception) { return; } $this->assertFalse($forwardActive); }
/** * Forwards the request to another action and / or controller. * * Request is directly transfered to the other action / controller * without the need for a new request. * * @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 $extensionName Name of the extension containing the controller to forward to. If not specified, the current extension is assumed. * @param array $arguments Arguments to pass to the target action * @return void * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException * @see redirect() * @api */ public function forward($actionName, $controllerName = NULL, $extensionName = NULL, array $arguments = NULL) { $this->request->setDispatched(FALSE); $this->request->setControllerActionName($actionName); if ($controllerName !== NULL) { $this->request->setControllerName($controllerName); } if ($extensionName !== NULL) { $this->request->setControllerExtensionName($extensionName); } if ($arguments !== NULL) { $this->request->setArguments($arguments); } throw new \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException(); }