コード例 #1
0
 public function testCanDoOfferVerifyCall()
 {
     $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock();
     $mockedSendResult = new Client\Session\Handler\SendResult();
     $mockedSendResult->responseXml = 'dummyofferverifymessage';
     $messageResult = new Client\Result($mockedSendResult);
     $expectedMessageResult = new Client\Struct\Offer\Verify(1, Client\Struct\Offer\OfferTattoo::SEGMENT_AIR);
     $mockSessionHandler->expects($this->once())->method('sendMessage')->with('Offer_VerifyOffer', $expectedMessageResult, ['endSession' => false])->will($this->returnValue($mockedSendResult));
     $mockSessionHandler->expects($this->never())->method('getLastResponse');
     $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['Offer_VerifyOffer' => "11.1"]));
     $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock();
     $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'Offer_VerifyOffer')->will($this->returnValue($messageResult));
     $par = new Params();
     $par->sessionHandler = $mockSessionHandler;
     $par->requestCreatorParams = new Params\RequestCreatorParams(['receivedFrom' => 'some RF string', 'originatorOfficeId' => 'BRUXXXXXX']);
     $par->responseHandler = $mockResponseHandler;
     $client = new Client($par);
     $response = $client->offerVerify(new Client\RequestOptions\OfferVerifyOptions(['offerReference' => 1, 'segmentName' => 'AIR']));
     $this->assertEquals($messageResult, $response);
 }