Example #1
0
 public function testCanSendMiniRuleGetFromPricing()
 {
     $mockedSendResult = new Client\Session\Handler\SendResult();
     $mockedSendResult->responseXml = $this->getTestFile('miniRuleGetFromPricing11Reply.txt');
     $mockedSendResult->responseObject = new \stdClass();
     $messageResult = new Client\Result($mockedSendResult);
     $expectedMessageResult = new Client\Struct\MiniRule\GetFromPricing(new Client\RequestOptions\MiniRuleGetFromPricingOptions(['pricings' => [1]]));
     $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock();
     $mockSessionHandler->expects($this->once())->method('sendMessage')->with('MiniRule_GetFromPricing', $expectedMessageResult, ['endSession' => false])->will($this->returnValue($mockedSendResult));
     $mockSessionHandler->expects($this->never())->method('getLastResponse');
     $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['MiniRule_GetFromPricing' => "11.1"]));
     $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock();
     $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'MiniRule_GetFromPricing')->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->miniRuleGetFromPricing(new Client\RequestOptions\MiniRuleGetFromPricingOptions(['pricings' => [1]]));
     $this->assertEquals($messageResult, $response);
 }