/** * @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')); }
/** * Test exception for handle * * @expectedException \Magento\Framework\Webapi\Exception * @expectedExceptionMessage exception message */ public function testHandleWithException() { $genWSDL = 'generatedWSDL'; $exceptionMsg = 'exception message'; $requestedService = ['catalogProduct']; $serviceMetadata = ['methods' => ['methodName' => ['interface' => 'aInterface']]]; $this->serviceMetadata->expects($this->any())->method('getServiceMetadata')->willReturn($serviceMetadata); $this->_typeProcessor->expects($this->once())->method('processInterfaceCallInfo')->willThrowException(new \Magento\Framework\Webapi\Exception(__($exceptionMsg))); $this->assertEquals($genWSDL, $this->_wsdlGenerator->generate($requestedService, 'http://', 'magento.host', '/soap/default')); }