Skip to content

Commit

Permalink
Fix test errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslan committed May 29, 2019
1 parent cfebefa commit 913d5d8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Amadeus/Client/Struct/Queue/TargetDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ public function __construct($targetQueue, $recordLocators, $originatorOffice)

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

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

foreach ($recordLocators as $recLoc) {
$this->recordLocator[] = new RecordLocator($recLoc);
Expand Down
27 changes: 26 additions & 1 deletion tests/Amadeus/Client/Struct/Queue/RemoveItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testCanMakeRemoveItemMessage()
$opt = new QueueRemoveItemOptions([
'recordLocator' => 'ABC123',
'originatorOfficeId' => 'BRUXX0000',
'queue' => new Queue(['queue' => 50, 'category' => 0, 'timeMode' => 1])
'queue' => new Queue(['queue' => 50, 'category' => 0])
]);

$msg = new RemoveItem(
Expand All @@ -51,6 +51,31 @@ public function testCanMakeRemoveItemMessage()
$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->assertNull($msg->targetDetails[0]->placementDate);
$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);
}


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));
Expand Down

0 comments on commit 913d5d8

Please sign in to comment.