Initialize the property mapping configuration in $controllerArguments if
the trusted properties are set inside the request.
public initializePropertyMappingConfigurationFromRequest ( |
||
$request | ||
$controllerArguments | ||
return | void |
/** * Handles a request. The result output is returned by altering the given response. * * @param RequestInterface $request The request object * @param ResponseInterface $response The response, modified by this handler * @return void * @throws UnsupportedRequestTypeException * @api */ public function processRequest(RequestInterface $request, ResponseInterface $response) { $this->initializeController($request, $response); $this->actionMethodName = $this->resolveActionMethodName(); $this->initializeActionMethodArguments(); $this->initializeActionMethodValidators(); $this->initializeAction(); $actionInitializationMethodName = 'initialize' . ucfirst($this->actionMethodName); if (method_exists($this, $actionInitializationMethodName)) { call_user_func([$this, $actionInitializationMethodName]); } $this->mvcPropertyMappingConfigurationService->initializePropertyMappingConfigurationFromRequest($this->request, $this->arguments); $this->mapRequestArgumentsToControllerArguments(); if ($this->view === null) { $this->view = $this->resolveView(); } if ($this->view !== null) { $this->view->assign('settings', $this->settings); $this->view->setControllerContext($this->controllerContext); $this->initializeView($this->view); } $this->callActionMethod(); }
/** * @test */ public function initializePropertyMappingConfigurationDoesNothingIfTrustedPropertiesAreNotSet() { $request = $this->getMockBuilder(Mvc\ActionRequest::class)->setMethods(['getInternalArgument'])->disableOriginalConstructor()->getMock(); $request->expects($this->any())->method('getInternalArgument')->with('__trustedProperties')->will($this->returnValue(null)); $arguments = new Mvc\Controller\Arguments(); $requestHashService = new Mvc\Controller\MvcPropertyMappingConfigurationService(); $requestHashService->initializePropertyMappingConfigurationFromRequest($request, $arguments); // dummy assertion to avoid PHPUnit warning $this->assertTrue(true); }