public function testCanSendPriceXplorerExtremeSearch() { $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock(); $mockedSendResult = new Client\Session\Handler\SendResult(); $mockedSendResult->responseXml = 'dummypricexplorerextremesearchresponsemessage'; $messageResult = new Client\Result($mockedSendResult); $expectedMessageResult = new Client\Struct\PriceXplorer\ExtremeSearch(new Client\RequestOptions\PriceXplorerExtremeSearchOptions(['resultAggregationOption' => Client\RequestOptions\PriceXplorerExtremeSearchOptions::AGGR_COUNTRY, 'origin' => 'BRU', 'destinations' => ['SYD', 'CBR'], 'earliestDepartureDate' => \DateTime::createFromFormat('Y-m-d', '2016-08-25', new \DateTimeZone('UTC')), 'latestDepartureDate' => \DateTime::createFromFormat('Y-m-d', '2016-09-28', new \DateTimeZone('UTC')), 'searchOffice' => 'LONBG2222'])); $mockSessionHandler->expects($this->once())->method('sendMessage')->with('PriceXplorer_ExtremeSearch', $expectedMessageResult, ['endSession' => false])->will($this->returnValue($mockedSendResult)); $mockSessionHandler->expects($this->never())->method('getLastResponse'); $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['PriceXplorer_ExtremeSearch' => "10.3"])); $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock(); $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'PriceXplorer_ExtremeSearch')->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->priceXplorerExtremeSearch(new Client\RequestOptions\PriceXplorerExtremeSearchOptions(['resultAggregationOption' => Client\RequestOptions\PriceXplorerExtremeSearchOptions::AGGR_COUNTRY, 'origin' => 'BRU', 'destinations' => ['SYD', 'CBR'], 'earliestDepartureDate' => \DateTime::createFromFormat('Y-m-d', '2016-08-25', new \DateTimeZone('UTC')), 'latestDepartureDate' => \DateTime::createFromFormat('Y-m-d', '2016-09-28', new \DateTimeZone('UTC')), 'searchOffice' => 'LONBG2222'])); $this->assertEquals($messageResult, $response); }