Example #1
0
 public function testCanDoDummyPnrRetrieveCall()
 {
     $mockedSendResult = new Client\Session\Handler\SendResult();
     $mockedSendResult->responseXml = 'A dummy message result';
     // Not an actual XML reply.
     $messageResult = new Client\Result($mockedSendResult);
     $expectedPnrResult = new Client\Struct\Pnr\Retrieve(Client\Struct\Pnr\Retrieve::RETR_TYPE_BY_RECLOC, 'ABC123');
     $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock();
     $mockSessionHandler->expects($this->once())->method('sendMessage')->with('PNR_Retrieve', $expectedPnrResult, ['endSession' => false])->will($this->returnValue($mockedSendResult));
     $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['PNR_Retrieve' => '14.2']));
     $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock();
     $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'PNR_Retrieve')->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->pnrRetrieve(new Client\RequestOptions\PnrRetrieveOptions(['recordLocator' => 'ABC123']));
     $this->assertEquals($messageResult, $response);
 }