Skip to content

Commit

Permalink
Simultaneous Changes error check
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed May 23, 2016
1 parent 94598ba commit 5ae9b55
Show file tree
Hide file tree
Showing 3 changed files with 695 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Amadeus/Client/ResponseHandler/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function analyzePnrRetrieveResponse($response)
$errorTextNodeList = $domXpath->query($queryAllErrorMsg);
$message = $this->makeMessageFromMessagesNodeList($errorTextNodeList);

$analyzeResponse->errors[] = new Result\NotOk($code, $message, 'general');
$analyzeResponse->errors[] = new Result\NotOk($code, trim($message), 'general');
}

//Segment errors:
Expand All @@ -116,7 +116,7 @@ protected function analyzePnrRetrieveResponse($response)
$errorTextNodeList = $domXpath->query($querySegmentErrorMsg);
$message = $this->makeMessageFromMessagesNodeList($errorTextNodeList);

$analyzeResponse->errors[] = new Result\NotOk($code, $message, 'segment');
$analyzeResponse->errors[] = new Result\NotOk($code, trim($message), 'segment');
}

//Element errors:
Expand All @@ -133,7 +133,7 @@ protected function analyzePnrRetrieveResponse($response)
$errorTextNodeList = $domXpath->query($queryElementErrorMsg);
$message = $this->makeMessageFromMessagesNodeList($errorTextNodeList);

$analyzeResponse->errors[] = new Result\NotOk($code, $message, 'element');
$analyzeResponse->errors[] = new Result\NotOk($code, trim($message), 'element');
}


Expand Down
16 changes: 16 additions & 0 deletions tests/Amadeus/Client/ResponseHandler/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@
*/
class BaseTest extends BaseTestCase
{
public function testCanFindSimultaneousChangesErrorMessageInPnrReply()
{
$respHandler = new ResponseHandler\Base();

$sendResult = new SendResult();
$sendResult->responseXml = $this->getTestFile('pnrAddMultiElementsSimultaneousChanges.txt');

$result = $respHandler->analyzeResponse($sendResult, 'PNR_AddMultiElements');

$this->assertEquals(Result::STATUS_ERROR, $result->status);
$this->assertEquals(1, count($result->errors));
$this->assertEquals('8111', $result->errors[0]->code);
$this->assertEquals("SIMULTANEOUS CHANGES TO PNR - USE WRA/RT TO PRINT OR IGNORE", $result->errors[0]->text);
$this->assertEquals('general', $result->errors[0]->level);
}

public function testCanFindTopLevelErrorMessageInPnrReply()
{
$respHandler = new ResponseHandler\Base();
Expand Down
Loading

0 comments on commit 5ae9b55

Please sign in to comment.