Пример #1
0
 public function testCanDoQueueRemoveItemCall()
 {
     $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock();
     $mockedSendResult = new Client\Session\Handler\SendResult();
     $mockedSendResult->responseXml = 'dumyremoveitemmessage';
     $messageResult = new Client\Result($mockedSendResult);
     $expectedMessageResult = new Client\Struct\Queue\RemoveItem(new Client\RequestOptions\Queue(['queue' => 50, 'category' => 0]), 'ABC123', 'BRUXX0000');
     $mockSessionHandler->expects($this->once())->method('sendMessage')->with('Queue_RemoveItem', $expectedMessageResult, ['endSession' => false])->will($this->returnValue($mockedSendResult));
     $mockSessionHandler->expects($this->never())->method('getLastResponse');
     $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['Queue_RemoveItem' => "11.1"]));
     $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock();
     $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'Queue_RemoveItem')->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->queueRemoveItem(new Client\RequestOptions\QueueRemoveItemOptions(['recordLocator' => 'ABC123', 'originatorOfficeId' => 'BRUXX0000', 'queue' => new Client\RequestOptions\Queue(['queue' => 50, 'category' => 0])]));
     $this->assertEquals($messageResult, $response);
 }