Skip to content

Commit

Permalink
Queue_RemoveItem missed timeMode property initialization is added. (#333
Browse files Browse the repository at this point in the history
)
  • Loading branch information
poltaev1993 authored and DerMika committed May 29, 2019
1 parent ac5f7ba commit 33fb2e1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Amadeus/Client/Struct/Queue/TargetDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public function __construct($targetQueue, $recordLocators, $originatorOffice)

$this->queueNumber = new QueueNumber($targetQueue->queue);
$this->categoryDetails = new CategoryDetails($targetQueue->category);

if (!empty($targetQueue->timeMode)) {
$this->placementDate = new QueueDate($targetQueue->timeMode);
}

foreach ($recordLocators as $recLoc) {
$this->recordLocator[] = new RecordLocator($recLoc);
Expand Down
26 changes: 26 additions & 0 deletions tests/Amadeus/Client/Struct/Queue/RemoveItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,31 @@ public function testCanMakeRemoveItemMessage()
$this->assertEquals(SubQueueInfoDetails::IDTYPE_CATEGORY, $msg->targetDetails[0]->categoryDetails->subQueueInfoDetails->identificationType);
$this->assertEquals(0, $msg->targetDetails[0]->categoryDetails->subQueueInfoDetails->itemNumber);
}


public function testCanMakeRemoveItemMessageWithTimeMode()
{
$opt = new QueueRemoveItemOptions([
'recordLocator' => 'ABC123',
'originatorOfficeId' => 'BRUXX0000',
'queue' => new Queue(['queue' => 50, 'category' => 0, 'timeMode' => 1])
]);

$msg = new RemoveItem(
$opt->queue,
$opt->recordLocator,
$opt->originatorOfficeId
);

$this->assertEquals(SourceType::SOURCETYPE_SAME_AS_ORIGINATOR, $msg->targetDetails[0]->targetOffice->sourceType->sourceQualifier1);
$this->assertEquals('ABC123', $msg->targetDetails[0]->recordLocator[0]->reservation->controlNumber);
$this->assertEquals(1, count($msg->targetDetails));
$this->assertEquals('BRUXX0000', $msg->targetDetails[0]->targetOffice->originatorDetails->inHouseIdentification1);
$this->assertNotNull($msg->targetDetails[0]->placementDate);
$this->assertEquals(1, $msg->targetDetails[0]->placementDate->timeMode);
$this->assertEquals(50, $msg->targetDetails[0]->queueNumber->queueDetails->number);
$this->assertEquals(SubQueueInfoDetails::IDTYPE_CATEGORY, $msg->targetDetails[0]->categoryDetails->subQueueInfoDetails->identificationType);
$this->assertEquals(0, $msg->targetDetails[0]->categoryDetails->subQueueInfoDetails->itemNumber);
}

}

0 comments on commit 33fb2e1

Please sign in to comment.