Skip to content

Commit

Permalink
PNR_AddMultiElements: also include automatic Received From in the pnr…
Browse files Browse the repository at this point in the history
…AddMultiElements() method, not only in the pnrCreatePnr() method (issue #50)
  • Loading branch information
DerMika committed Mar 22, 2017
1 parent d62dfdb commit c16cd0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

use Amadeus\Client\RequestCreator\Converter\BaseConverter;
use Amadeus\Client\RequestOptions\PnrAddMultiElementsBase;
use Amadeus\Client\RequestOptions\PnrCreatePnrOptions;
use Amadeus\Client\Struct;

/**
Expand All @@ -42,7 +41,7 @@ class AddMultiElementsConv extends BaseConverter
*/
public function convert($requestOptions, $version)
{
if ($requestOptions instanceof PnrCreatePnrOptions && empty($requestOptions->receivedFrom)) {
if (empty($requestOptions->receivedFrom)) {
//Automagically add RF if not present:
$requestOptions->receivedFrom = $this->params->receivedFrom;
}
Expand Down
12 changes: 9 additions & 3 deletions tests/Amadeus/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,15 @@ public function testCanDoAddMultiElementsSavePNR()

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

$options = new Client\RequestOptions\PnrAddMultiElementsOptions();
$options->actionCode = 11; //11 End transact with retrieve (ER)
$expectedPnrResult = new Client\Struct\Pnr\AddMultiElements($options);
$options = new Client\RequestOptions\PnrAddMultiElementsOptions([
'actionCode' => Client\RequestOptions\PnrAddMultiElementsOptions::ACTION_END_TRANSACT_RETRIEVE,
]);

/** @var Client\RequestOptions\PnrAddMultiElementsOptions $expectedResultOpt */
$expectedResultOpt = clone $options;
$expectedResultOpt->receivedFrom = 'some RF string '.Client::RECEIVED_FROM_IDENTIFIER.'-'.Client::VERSION;

$expectedPnrResult = new Client\Struct\Pnr\AddMultiElements($expectedResultOpt);

$mockSessionHandler
->expects($this->once())
Expand Down

0 comments on commit c16cd0d

Please sign in to comment.