Пример #1
0
 /**
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if (!$event->isMasterRequest()) {
         return;
     }
     $request = $event->getRequest();
     $swaggerDocument = $this->schemaRepository->get($request->get('_definition'));
     $operationDefinition = $swaggerDocument->getOperationDefinition($request->getPathInfo(), $request->getMethod());
     $this->processor->process($request, $operationDefinition);
 }
 /**
  * @test
  */
 public function willCoerceRequest()
 {
     /** @var RequestValidator $contentDecoderMock */
     $validatorMock = $this->getMockBuilder('KleijnWeb\\SwaggerBundle\\Request\\RequestValidator')->disableOriginalConstructor()->getMock();
     /** @var RequestCoercer $contentDecoderMock */
     $coercerMock = $this->getMockBuilder('KleijnWeb\\SwaggerBundle\\Request\\RequestCoercer')->disableOriginalConstructor()->getMock();
     $request = new Request();
     $coercerMock->expects($this->once())->method('coerceRequest')->with($request);
     $processor = new RequestProcessor($validatorMock, $coercerMock);
     $operationDefinition = ['parameters' => [['name' => 'myContent', 'in' => 'body']]];
     $processor->process($request, $operationDefinition);
 }