public function testCanSendDocIssuanceIssueTicket() { $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock(); $mockedSendResult = new Client\Session\Handler\SendResult(); $mockedSendResult->responseXml = 'dummydocissuanceissueticketresponse'; $messageResult = new Client\Result($mockedSendResult); $expectedMessageResult = new Client\Struct\DocIssuance\IssueTicket(new Client\RequestOptions\DocIssuanceIssueTicketOptions(['options' => [Client\RequestOptions\DocIssuanceIssueTicketOptions::OPTION_ETICKET]])); $mockSessionHandler->expects($this->once())->method('sendMessage')->with('DocIssuance_IssueTicket', $expectedMessageResult, ['endSession' => false])->will($this->returnValue($mockedSendResult)); $mockSessionHandler->expects($this->never())->method('getLastResponse'); $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['DocIssuance_IssueTicket' => "9.1"])); $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock(); $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'DocIssuance_IssueTicket')->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->docIssuanceIssueTicket(new Client\RequestOptions\DocIssuanceIssueTicketOptions(['options' => [Client\RequestOptions\DocIssuanceIssueTicketOptions::OPTION_ETICKET]])); $this->assertEquals($messageResult, $response); }