Exemplo n.º 1
0
 /**
  * @param string[] $serviceMetadata
  * @param string[] $typeData
  * @param string $schema
  * @dataProvider generateDataProvider
  */
 public function testGenerate($serviceMetadata, $typeData, $schema)
 {
     $service = 'testModule5AllSoapAndRestV2';
     $requestedService = [$service];
     $this->serviceMetadataMock->expects($this->any())->method('getRouteMetadata')->willReturn($serviceMetadata);
     $this->typeProcessorMock->expects($this->any())->method('getTypeData')->willReturnMap([['TestModule5V2EntityAllSoapAndRest', $typeData]]);
     $this->typeProcessorMock->expects($this->any())->method('isTypeSimple')->willReturnMap([['int', true]]);
     $this->assertEquals($schema, $this->generator->generate($requestedService, 'http://', 'magento.host', '/rest/default/schema?services=service1'));
 }
Exemplo n.º 2
0
 /**
  * Execute schema request
  *
  * @return void
  */
 protected function processSchemaRequest()
 {
     $requestedServices = $this->_request->getRequestedServices('all');
     $requestedServices = $requestedServices == Request::ALL_SERVICES ? array_keys($this->swaggerGenerator->getListOfServices()) : $requestedServices;
     $responseBody = $this->swaggerGenerator->generate($requestedServices, $this->_request->getScheme(), $this->_request->getHttpHost(), $this->_request->getRequestUri());
     $this->_response->setBody($responseBody)->setHeader('Content-Type', 'application/json');
 }