Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed Mar 10, 2016
2 parents 07624ef + 60d055e commit 3a9b4c0
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 12 deletions.
20 changes: 10 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Amadeus/Client/Session/Handler/SoapHeader4.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function __construct(Client\Params\SessionHandlerParams $params)
$this->params = $params;
if($params->logger instanceof LoggerInterface) {
$this->setLogger($params->logger);
$this->log(LogLevel::INFO, __METHOD__. "(): Logger started.");
//$this->log(LogLevel::INFO, __METHOD__. "(): Logger started.");
}
if ($params->overrideSoapClient instanceof \SoapClient) {
$this->soapClient = $params->overrideSoapClient;
Expand Down
4 changes: 3 additions & 1 deletion src/Amadeus/Client/Struct/Queue/TargetDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public function __construct($targetQueue, $recordLocators, $originatorOffice)
$theRealOffice = $targetQueue->officeId;
}

$this->targetOffice = new TargetOffice($sourceType, $theRealOffice);
if (!is_null($theRealOffice)) {
$this->targetOffice = new TargetOffice($sourceType, $theRealOffice);
}

$this->queueNumber = new QueueNumber($targetQueue->queue);
$this->categoryDetails = new CategoryDetails($targetQueue->category);
Expand Down
89 changes: 89 additions & 0 deletions tests/Amadeus/Client/Struct/Queue/PlacePnrTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/**
* amadeus-ws-client
*
* Copyright 2015 Amadeus Benelux NV
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package Amadeus
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0
*/

namespace Test\Amadeus\Client\Struct\Queue;

use Amadeus\Client\RequestOptions\Queue;
use Amadeus\Client\RequestOptions\QueuePlacePnrOptions;
use Amadeus\Client\Struct\Queue\PlacePnr;
use Amadeus\Client\Struct\Queue\SelectionDetails;
use Amadeus\Client\Struct\Queue\SourceType;
use Amadeus\Client\Struct\Queue\SubQueueInfoDetails;
use Test\Amadeus\BaseTestCase;

/**
* PlacePnrTest
*
* @package Test\Amadeus\Client\Struct\Queue
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class PlacePnrTest extends BaseTestCase
{

public function testCanPlacePnrOnQueueWithNoOffice()
{
$opt = new QueuePlacePnrOptions([
'recordLocator' => 'ABC123',
'targetQueue' => new Queue([
'queue' => 30,
'category' => 5
])
]);

$msg = new PlacePnr(
$opt->recordLocator,
$opt->sourceOfficeId,
$opt->targetQueue
);


$this->assertEquals('ABC123', $msg->recordLocator->reservation->controlNumber);
$this->assertEquals(SelectionDetails::PLACEPNR_OPTION_QUEUE, $msg->placementOption->selectionDetails->option);
$this->assertEquals(1, count($msg->targetDetails));
$this->assertNull($msg->targetDetails[0]->targetOffice);
$this->assertEquals(30, $msg->targetDetails[0]->queueNumber->queueDetails->number);
$this->assertNull($msg->targetDetails[0]->placementDate);
$this->assertEquals(5, $msg->targetDetails[0]->categoryDetails->subQueueInfoDetails->itemNumber);
$this->assertEquals(SubQueueInfoDetails::IDTYPE_CATEGORY, $msg->targetDetails[0]->categoryDetails->subQueueInfoDetails->identificationType);
}

public function testCanPlacePnrOnQueueWithOffice()
{
$opt = new QueuePlacePnrOptions([
'recordLocator' => 'ABC123',
'sourceOfficeId' => 'BRU1AXXXX',
'targetQueue' => new Queue([
'queue' => 30,
'category' => 5
])
]);

$msg = new PlacePnr(
$opt->recordLocator,
$opt->sourceOfficeId,
$opt->targetQueue
);

$this->assertEquals('BRU1AXXXX', $msg->targetDetails[0]->targetOffice->originatorDetails->inHouseIdentification1);
$this->assertEquals(SourceType::SOURCETYPE_SAME_AS_ORIGINATOR, $msg->targetDetails[0]->targetOffice->sourceType->sourceQualifier1);
}
}

0 comments on commit 3a9b4c0

Please sign in to comment.