Skip to content

Commit

Permalink
For #398 Add test for Client::ticketAtcShopperMasterPricerCalendar() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
therealartz committed May 28, 2020
1 parent f6d4ec7 commit 3609afd
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions tests/Amadeus/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,69 @@ public function testCanDoTicketAtcShopperMasterPricerTravelBoardSearch()
$this->assertEquals($messageResult, $response);
}

public function testCanDoTicketAtcShopperMasterPricerCalendar()
{
$mockSessionHandler = $this->getMockBuilder('Amadeus\Client\Session\Handler\HandlerInterface')->getMock();

$mockedSendResult = new Client\Session\Handler\SendResult();
$mockedSendResult->responseXml = 'dummyTicketAtcShopperMasterPricerCalendarMessage';

$messageResult = new Client\Result($mockedSendResult);

$expectedMessageResult = new Client\Struct\Ticket\AtcShopperMasterPricerCalendar(
new Client\RequestOptions\TicketAtcShopperMpCalendarOptions([

])
);

$mockSessionHandler
->expects($this->once())
->method('sendMessage')
->with(
'Ticket_ATCShopperMasterPricerCalendar',
$expectedMessageResult,
['endSession' => false, 'returnXml' => true]
)
->willReturn($mockedSendResult);

$mockSessionHandler
->expects($this->never())
->method('getLastResponse');

$mockSessionHandler
->expects($this->once())
->method('getMessagesAndVersions')
->willReturn([
'Ticket_ATCShopperMasterPricerCalendar' => ['version' => '18.2', 'wsdl' => 'dc22e4ee']
]);

$mockResponseHandler = $this->getMockBuilder('Amadeus\Client\ResponseHandler\ResponseHandlerInterface')->getMock();

$mockResponseHandler
->expects($this->once())
->method('analyzeResponse')
->with($mockedSendResult, 'Ticket_ATCShopperMasterPricerCalendar')
->willReturn($messageResult);

$par = new Params();
$par->sessionHandler = $mockSessionHandler;
$par->requestCreatorParams = new Params\RequestCreatorParams([
'receivedFrom' => 'some RF string',
'originatorOfficeId' => 'NYCXXXXXX'
]);
$par->responseHandler = $mockResponseHandler;

$client = new Client($par);

$response = $client->ticketAtcShopperMasterPricerCalendar(
new Client\RequestOptions\TicketAtcShopperMpCalendarOptions([

])
);

$this->assertEquals($messageResult, $response);
}

public function testCanDoTicketRepricePNRWithBookingClass()
{
$mockSessionHandler = $this->getMockBuilder('Amadeus\Client\Session\Handler\HandlerInterface')->getMock();
Expand Down

0 comments on commit 3609afd

Please sign in to comment.