public function testCanDoDummyPnrCancelCall() { $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock(); $mockedSendResult = new Client\Session\Handler\SendResult(); $mockedSendResult->responseObject = new \stdClass(); $mockedSendResult->responseObject->dummyProp = 'A dummy message result'; // Not an actual Soap reply. $mockedSendResult->responseXml = 'A dummy message result'; // Not an actual XML reply $messageResult = new Client\Result($mockedSendResult); $expectedPnrResult = new Client\Struct\Pnr\Cancel(new Client\RequestOptions\PnrCancelOptions(['actionCode' => 10, 'cancelItinerary' => true])); $mockSessionHandler->expects($this->once())->method('sendMessage')->with('PNR_Cancel', $expectedPnrResult, ['endSession' => false])->will($this->returnValue($mockedSendResult)); $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['PNR_Cancel' => '14.2'])); $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock(); $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'PNR_Cancel')->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->pnrCancel(new Client\RequestOptions\PnrCancelOptions(['actionCode' => 10, 'cancelItinerary' => true])); $this->assertEquals($messageResult, $response); }