forked from tijsverkoyen/bpost
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only the first option was filled
- Loading branch information
1 parent
e02ca4b
commit 413a417
Showing
8 changed files
with
123 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,8 +97,35 @@ public function testCreateFromXml() | |
|
||
/** @var Option[] $options */ | ||
$options = $self->getOptions(); | ||
$this->assertNotNull($options); | ||
// @todo Fix options feeding and test it | ||
$this->assertCount(4, $options); | ||
|
||
/** @var Messaging $option */ | ||
$option = $options[0]; | ||
$this->assertSame('Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging', get_class($option)); | ||
$this->assertSame(Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED, $option->getType()); | ||
$this->assertSame(Messaging::MESSAGING_LANGUAGE_EN, $option->getLanguage()); | ||
$this->assertNull($option->getEmailAddress()); | ||
$this->assertSame('0476123456', $option->getMobilePhone()); | ||
|
||
/** @var Messaging $option */ | ||
$option = $options[1]; | ||
$this->assertSame('Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging', get_class($option)); | ||
$this->assertSame(Messaging::MESSAGING_TYPE_INFO_NEXT_DAY, $option->getType()); | ||
$this->assertSame(Messaging::MESSAGING_LANGUAGE_EN, $option->getLanguage()); | ||
$this->assertSame('[email protected]', $option->getEmailAddress()); | ||
$this->assertNull($option->getMobilePhone()); | ||
|
||
/** @var Messaging $option */ | ||
$option = $options[2]; | ||
$this->assertSame('Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging', get_class($option)); | ||
$this->assertSame(Messaging::MESSAGING_TYPE_INFO_REMINDER, $option->getType()); | ||
$this->assertSame(Messaging::MESSAGING_LANGUAGE_EN, $option->getLanguage()); | ||
$this->assertNull($option->getEmailAddress()); | ||
$this->assertSame('0032475123456', $option->getMobilePhone()); | ||
|
||
/** @var SaturdayDelivery $option */ | ||
$option = $options[3]; | ||
$this->assertSame('Bpost\BpostApiClient\Bpost\Order\Box\Option\SaturdayDelivery', get_class($option)); | ||
|
||
$this->assertSame(500, $self->getWeight()); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,8 +135,45 @@ public function testCreateFromXml() | |
$this->assertSame('2016-03-19+01:00', $nationalBox->getRequestedDeliveryDate()); | ||
$this->assertSame('Rue de l\'Autonomie', $nationalBox->getPugoAddress()->getStreetName()); | ||
|
||
$this->assertNotNull($nationalBox->getOptions()); | ||
// $this->assertCount(6, $nationalBox->getOptions()); | ||
$this->assertCount(6, $nationalBox->getOptions()); | ||
$options = $nationalBox->getOptions(); | ||
|
||
/** @var Box\Option\Messaging $option */ | ||
$option = $options[0]; | ||
$this->assertInstanceOf('Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging', $option); | ||
$this->assertSame(Box\Option\Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED, $option->getType()); | ||
$this->assertSame(Box\Option\Messaging::MESSAGING_LANGUAGE_FR, $option->getLanguage()); | ||
$this->assertNull($option->getMobilePhone()); | ||
$this->assertSame('[email protected]', $option->getEmailAddress()); | ||
|
||
/** @var Box\Option\Messaging $option */ | ||
$option = $options[1]; | ||
$this->assertInstanceOf('Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging', $option); | ||
$this->assertSame(Box\Option\Messaging::MESSAGING_TYPE_KEEP_ME_INFORMED, $option->getType()); | ||
$this->assertSame(Box\Option\Messaging::MESSAGING_LANGUAGE_EN, $option->getLanguage()); | ||
$this->assertNull($option->getMobilePhone()); | ||
$this->assertSame('[email protected]', $option->getEmailAddress()); | ||
|
||
/** @var Box\Option\Insured $option */ | ||
$option = $options[2]; | ||
$this->assertInstanceOf('Bpost\BpostApiClient\Bpost\Order\Box\Option\Insured', $option); | ||
$this->assertSame(Box\Option\Insured::INSURANCE_TYPE_ADDITIONAL_INSURANCE, $option->getType()); | ||
$this->assertSame(Box\Option\Insured::INSURANCE_AMOUNT_UP_TO_2500_EUROS, $option->getValue()); | ||
|
||
/** @var Box\Option\Signed $option */ | ||
$option = $options[3]; | ||
$this->assertInstanceOf('Bpost\BpostApiClient\Bpost\Order\Box\Option\Signed', $option); | ||
|
||
/** @var Box\Option\SaturdayDelivery $option */ | ||
$option = $options[4]; | ||
$this->assertInstanceOf('Bpost\BpostApiClient\Bpost\Order\Box\Option\SaturdayDelivery', $option); | ||
|
||
/** @var Box\Option\CashOnDelivery $option */ | ||
$option = $options[5]; | ||
$this->assertInstanceOf('Bpost\BpostApiClient\Bpost\Order\Box\Option\CashOnDelivery', $option); | ||
$this->assertSame(1234.56, $option->getAmount()); | ||
$this->assertSame('BE19 2100 2350 8812', $option->getIban()); | ||
$this->assertSame('GEBABEBB', $option->getBic()); | ||
} | ||
|
||
private function getFetchOrderWithReferenceXml() | ||
|
@@ -198,7 +235,7 @@ private function getFetchOrderXml() | |
<ns2:signed/> | ||
<ns2:saturdayDelivery/> | ||
<ns2:cod> | ||
<ns2:codAmount>1234</ns2:codAmount> | ||
<ns2:codAmount>1234.56</ns2:codAmount> | ||
<ns2:iban>BE19 2100 2350 8812</ns2:iban> | ||
<ns2:bic>GEBABEBB</ns2:bic> | ||
</ns2:cod> | ||
|