/** * Process and resolve input parameters * * @return array * @throws \Magento\Framework\Webapi\Exception */ public function resolve() { $this->requestValidator->validate(); $route = $this->getRoute(); $serviceMethodName = $route->getServiceMethod(); $serviceClassName = $route->getServiceClass(); /* * Valid only for updates using PUT when passing id value both in URL and body */ if ($this->request->getHttpMethod() == RestRequest::HTTP_METHOD_PUT) { $inputData = $this->paramsOverrider->overrideRequestBodyIdWithPathParam($this->request->getParams(), $this->request->getBodyParams(), $serviceClassName, $serviceMethodName); $inputData = array_merge($inputData, $this->request->getParams()); } else { $inputData = $this->request->getRequestData(); } $inputData = $this->paramsOverrider->override($inputData, $route->getParameters()); $inputParams = $this->serviceInputProcessor->process($serviceClassName, $serviceMethodName, $inputData); return $inputParams; }
/** * @expectedException \Magento\Framework\Exception\AuthorizationException * @expectedExceptionMessage Consumer is not authorized to access 5, 6 */ public function testAuthorizationFailed() { $this->authorizationMock->expects($this->once())->method('isAllowed')->will($this->returnValue(false)); $this->routeMock->expects($this->any())->method('getAclResources')->will($this->returnValue(['5', '6'])); $this->requestValidator->validate(); }