From 639557aeb8e82d460f53c10c3bf334aefd8cabc0 Mon Sep 17 00:00:00 2001 From: kouinkouin Date: Sun, 13 Oct 2024 22:47:10 +0200 Subject: [PATCH] refactor: xml namespaces are stored in php constants --- src/Bpost.php | 9 ++++++ .../CreateLabelInBulkForOrdersBuilder.php | 3 +- .../HttpRequestBuilder/ModifyOrderBuilder.php | 3 +- src/Bpost/Order.php | 31 +++++-------------- src/Bpost/Order/Box.php | 7 +++-- src/Bpost/Order/Box/At247.php | 7 ++--- src/Bpost/Order/Box/AtBpost.php | 5 +-- src/Bpost/Order/Box/AtHome.php | 3 +- src/Bpost/Order/Box/AtIntlPugo.php | 9 +++--- src/Bpost/Order/Box/BpostOnAppointment.php | 3 +- src/Bpost/Order/Box/International.php | 7 ++--- src/Bpost/Order/Box/National.php | 3 +- src/Bpost/Order/Box/Option/Insured.php | 2 +- src/Bpost/Order/Box/Option/Messaging.php | 3 +- tests/Bpost/Order/Box/AtHomeTest.php | 31 +++++-------------- .../Order/Box/BpostOnAppointmentTest.php | 31 +++++-------------- .../Box/International/ParcelContentTest.php | 6 ++-- tests/Bpost/Order/Box/NationalTest.php | 31 +++++-------------- .../Bpost/Order/Box/Option/InsuranceTest.php | 31 +++++-------------- tests/Bpost/OrderTest.php | 31 +++++-------------- ...resentationAndAdditionalInsurance3Test.php | 31 +++++-------------- ...econdPresentationAndBasicInsuranceTest.php | 31 +++++-------------- ...kWorldBusinessAdditionalInsurance3Test.php | 31 +++++-------------- .../BpackWorldBusinessBasicInsuranceTest.php | 31 +++++-------------- .../BpackWorldBusinessNoOptionsTest.php | 31 +++++-------------- .../BpackWorldEasyReturnNoOptionsTest.php | 31 +++++-------------- ...orldExpressProAdditionalInsurance3Test.php | 31 +++++-------------- ...BpackWorldExpressProBasicInsuranceTest.php | 31 +++++-------------- .../BpackWorldExpressProNoOptionsTest.php | 31 +++++-------------- 29 files changed, 146 insertions(+), 389 deletions(-) diff --git a/src/Bpost.php b/src/Bpost.php index bc378726..ebb9550d 100644 --- a/src/Bpost.php +++ b/src/Bpost.php @@ -43,6 +43,15 @@ class Bpost const LABEL_FORMAT_A4 = 'A4'; const LABEL_FORMAT_A6 = 'A6'; + const NS_V3_GLOBAL = 'http://schema.post.be/shm/deepintegration/v3/'; + const NS_V3_COMMON = 'http://schema.post.be/shm/deepintegration/v3/common'; + const NS_V3_NATIONAL = 'http://schema.post.be/shm/deepintegration/v3/national'; + const NS_V3_INTERNATIONAL = 'http://schema.post.be/shm/deepintegration/v3/international'; + const NS_V5_GLOBAL = 'http://schema.post.be/shm/deepintegration/v5/'; + const NS_V5_COMMON = 'http://schema.post.be/shm/deepintegration/v5/common'; + const NS_V5_NATIONAL = 'http://schema.post.be/shm/deepintegration/v5/national'; + const NS_V5_INTERNATIONAL = 'http://schema.post.be/shm/deepintegration/v5/international'; + // URL for the api const API_URL = 'https://shm-rest.bpost.cloud/services/shm'; diff --git a/src/Bpost/HttpRequestBuilder/CreateLabelInBulkForOrdersBuilder.php b/src/Bpost/HttpRequestBuilder/CreateLabelInBulkForOrdersBuilder.php index ee5444a5..c25c9161 100644 --- a/src/Bpost/HttpRequestBuilder/CreateLabelInBulkForOrdersBuilder.php +++ b/src/Bpost/HttpRequestBuilder/CreateLabelInBulkForOrdersBuilder.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\HttpRequestBuilder; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Common\ValidatedValue\LabelFormat; use DOMDocument; use DOMException; @@ -57,7 +58,7 @@ public function getXml() $document->formatOutput = true; $batchLabels = $document->createElement('batchLabels'); - $batchLabels->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v3/'); + $batchLabels->setAttribute('xmlns', Bpost::NS_V3_GLOBAL); foreach ($this->references as $reference) { $batchLabels->appendChild( $document->createElement('order', $reference) diff --git a/src/Bpost/HttpRequestBuilder/ModifyOrderBuilder.php b/src/Bpost/HttpRequestBuilder/ModifyOrderBuilder.php index f9ccea7a..9b151b34 100644 --- a/src/Bpost/HttpRequestBuilder/ModifyOrderBuilder.php +++ b/src/Bpost/HttpRequestBuilder/ModifyOrderBuilder.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\HttpRequestBuilder; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Box; use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; use DOMDocument; @@ -40,7 +41,7 @@ public function getXml() $document->formatOutput = true; $orderUpdate = $document->createElement('orderUpdate'); - $orderUpdate->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v3/'); + $orderUpdate->setAttribute('xmlns', Bpost::NS_V3_GLOBAL); $orderUpdate->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $orderUpdate->appendChild( $document->createElement('status', $this->status) diff --git a/src/Bpost/Order.php b/src/Bpost/Order.php index 6c7d19ad..f1cb3fef 100644 --- a/src/Bpost/Order.php +++ b/src/Bpost/Order.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Box; use Bpost\BpostApiClient\Bpost\Order\Line; use Bpost\BpostApiClient\Exception\BpostNotImplementedException; @@ -158,30 +159,12 @@ public function toXML(DOMDocument $document, $accountId) $order = $document->createElement( 'tns:order' ); - $order->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $order->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $order->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $order->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $order->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $order->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $order->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $order->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $order->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $order->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $order->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $order->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($order); diff --git a/src/Bpost/Order/Box.php b/src/Bpost/Order/Box.php index 4da22be0..19fc17e1 100644 --- a/src/Bpost/Order/Box.php +++ b/src/Bpost/Order/Box.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\Order; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Common\XmlHelper; use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; use Bpost\BpostApiClient\Exception\BpostNotImplementedException; @@ -232,14 +233,14 @@ public static function createFromXML(SimpleXMLElement $xml) $box->setSender( Sender::createFromXML( $xml->sender->children( - 'http://schema.post.be/shm/deepintegration/v3/common' + Bpost::NS_V3_COMMON ) ) ); } if (isset($xml->nationalBox)) { /** @var SimpleXMLElement $nationalBoxData */ - $nationalBoxData = $xml->nationalBox->children('http://schema.post.be/shm/deepintegration/v3/national'); + $nationalBoxData = $xml->nationalBox->children(Bpost::NS_V3_NATIONAL); // build classname based on the tag name $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst($nationalBoxData->getName()); @@ -255,7 +256,7 @@ public static function createFromXML(SimpleXMLElement $xml) } if (isset($xml->internationalBox)) { /** @var SimpleXMLElement $internationalBoxData */ - $internationalBoxData = $xml->internationalBox->children('http://schema.post.be/shm/deepintegration/v3/international'); + $internationalBoxData = $xml->internationalBox->children(Bpost::NS_V3_INTERNATIONAL); // build classname based on the tag name $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst($internationalBoxData->getName()); diff --git a/src/Bpost/Order/Box/At247.php b/src/Bpost/Order/Box/At247.php index 81e74655..9e186e8d 100644 --- a/src/Bpost/Order/Box/At247.php +++ b/src/Bpost/Order/Box/At247.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\Order\Box; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Box\National\Unregistered; use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging; use Bpost\BpostApiClient\Bpost\Order\ParcelsDepotAddress; @@ -322,7 +323,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul if (isset($xml->{'at24-7'}->options)) { /** @var SimpleXMLElement $optionData */ foreach ($xml->{'at24-7'}->options as $optionData) { - $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); + $optionData = $optionData->children(Bpost::NS_V3_COMMON); if (in_array($optionData->getName(), array(Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED))) { $option = Messaging::createFromXML($optionData); @@ -365,9 +366,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul } if (isset($xml->{'at24-7'}->parcelsDepotAddress)) { /** @var SimpleXMLElement $parcelsDepotAddressData */ - $parcelsDepotAddressData = $xml->{'at24-7'}->parcelsDepotAddress->children( - 'http://schema.post.be/shm/deepintegration/v3/common' - ); + $parcelsDepotAddressData = $xml->{'at24-7'}->parcelsDepotAddress->children(Bpost::NS_V3_COMMON); $at247->setParcelsDepotAddress( ParcelsDepotAddress::createFromXML($parcelsDepotAddressData) ); diff --git a/src/Bpost/Order/Box/AtBpost.php b/src/Bpost/Order/Box/AtBpost.php index c144eb58..536ecbb5 100644 --- a/src/Bpost/Order/Box/AtBpost.php +++ b/src/Bpost/Order/Box/AtBpost.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\Order\Box; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Box\National\ShopHandlingInstruction; use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging; use Bpost\BpostApiClient\Bpost\Order\PugoAddress; @@ -281,7 +282,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul if (isset($xml->atBpost->options)) { /** @var SimpleXMLElement $optionData */ foreach ($xml->atBpost->options as $optionData) { - $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); + $optionData = $optionData->children(Bpost::NS_V3_COMMON); if (in_array( $optionData->getName(), @@ -329,7 +330,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul if (isset($xml->atBpost->pugoAddress)) { /** @var SimpleXMLElement $pugoAddressData */ $pugoAddressData = $xml->atBpost->pugoAddress->children( - 'http://schema.post.be/shm/deepintegration/v3/common' + Bpost::NS_V3_COMMON ); $atBpost->setPugoAddress( PugoAddress::createFromXML($pugoAddressData) diff --git a/src/Bpost/Order/Box/AtHome.php b/src/Bpost/Order/Box/AtHome.php index a8e01a1e..76875a37 100644 --- a/src/Bpost/Order/Box/AtHome.php +++ b/src/Bpost/Order/Box/AtHome.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\Order\Box; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Receiver; use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product; use Bpost\BpostApiClient\Common\XmlHelper; @@ -159,7 +160,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul if (isset($atHomeXml->receiver)) { $self->setReceiver( Receiver::createFromXML( - $atHomeXml->receiver->children('http://schema.post.be/shm/deepintegration/v3/common') + $atHomeXml->receiver->children(Bpost::NS_V3_COMMON) ) ); } diff --git a/src/Bpost/Order/Box/AtIntlPugo.php b/src/Bpost/Order/Box/AtIntlPugo.php index 7f056e78..af794a65 100644 --- a/src/Bpost/Order/Box/AtIntlPugo.php +++ b/src/Bpost/Order/Box/AtIntlPugo.php @@ -1,6 +1,7 @@ atIntlPugo->options)) { /** @var \SimpleXMLElement $optionData */ foreach ($xml->atIntlPugo->options as $optionData) { - $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); + $optionData = $optionData->children(Bpost::NS_V3_COMMON); if (in_array( $optionData->getName(), @@ -288,7 +289,7 @@ public static function createFromXML(\SimpleXMLElement $xml) if (isset($xml->atIntlPugo->receiver) && $xml->atIntlPugo->receiver != '') { $self->setReceiver( Receiver::createFromXML( - $xml->atIntlPugo->receiver->children('http://schema.post.be/shm/deepintegration/v3/common') + $xml->atIntlPugo->receiver->children(Bpost::NS_V3_COMMON) ) ); } @@ -304,9 +305,7 @@ public static function createFromXML(\SimpleXMLElement $xml) } if (isset($xml->atIntlPugo->pugoAddress)) { /** @var \SimpleXMLElement $pugoAddressData */ - $pugoAddressData = $xml->atIntlPugo->pugoAddress->children( - 'http://schema.post.be/shm/deepintegration/v3/common' - ); + $pugoAddressData = $xml->atIntlPugo->pugoAddress->children(Bpost::NS_V3_COMMON); $self->setPugoAddress( PugoAddress::createFromXML($pugoAddressData) ); diff --git a/src/Bpost/Order/Box/BpostOnAppointment.php b/src/Bpost/Order/Box/BpostOnAppointment.php index 39a3b7d1..7f0a18cc 100644 --- a/src/Bpost/Order/Box/BpostOnAppointment.php +++ b/src/Bpost/Order/Box/BpostOnAppointment.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\Order\Box; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Receiver; use Bpost\BpostApiClient\Common\XmlHelper; use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException; @@ -125,7 +126,7 @@ public static function createFromXML(SimpleXMLElement $xml, National $self = nul if (isset($bpostOnAppointmentXml->receiver)) { $self->setReceiver( Receiver::createFromXML( - $bpostOnAppointmentXml->receiver->children('http://schema.post.be/shm/deepintegration/v3/common') + $bpostOnAppointmentXml->receiver->children(Bpost::NS_V3_COMMON) ) ); } diff --git a/src/Bpost/Order/Box/International.php b/src/Bpost/Order/Box/International.php index f2f91533..b441a99b 100644 --- a/src/Bpost/Order/Box/International.php +++ b/src/Bpost/Order/Box/International.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\Order\Box; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo; use Bpost\BpostApiClient\Bpost\Order\Box\International\ParcelContent; use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging; @@ -295,7 +296,7 @@ public static function createFromXML(SimpleXMLElement $xml) } if (isset($xml->international->options)) { /** @var SimpleXMLElement $optionData */ - $options = $xml->international->options->children('http://schema.post.be/shm/deepintegration/v3/common'); + $options = $xml->international->options->children(Bpost::NS_V3_COMMON); foreach ($options as $optionData) { switch ($optionData->getName()) { case Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED: @@ -322,9 +323,7 @@ public static function createFromXML(SimpleXMLElement $xml) ); } if (isset($xml->international->receiver)) { - $receiverData = $xml->international->receiver->children( - 'http://schema.post.be/shm/deepintegration/v3/common' - ); + $receiverData = $xml->international->receiver->children(Bpost::NS_V3_COMMON); $international->setReceiver( Receiver::createFromXML($receiverData) ); diff --git a/src/Bpost/Order/Box/National.php b/src/Bpost/Order/Box/National.php index 60101012..6886a8f1 100644 --- a/src/Bpost/Order/Box/National.php +++ b/src/Bpost/Order/Box/National.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\Order\Box; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Box\OpeningHour\Day; use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging; use Bpost\BpostApiClient\Bpost\Order\Box\Option\Option; @@ -234,7 +235,7 @@ public static function createFromXML(SimpleXMLElement $nationalXml, National $se if (isset($nationalXml->options) && !empty($nationalXml->options)) { /** @var SimpleXMLElement $optionData */ foreach ($nationalXml->options as $optionData) { - $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); + $optionData = $optionData->children(Bpost::NS_V3_COMMON); if (in_array($optionData->getName(), array( Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED, diff --git a/src/Bpost/Order/Box/Option/Insured.php b/src/Bpost/Order/Box/Option/Insured.php index 09a7fc41..3456648e 100644 --- a/src/Bpost/Order/Box/Option/Insured.php +++ b/src/Bpost/Order/Box/Option/Insured.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\Order\Box\Option; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Common\XmlHelper; use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; use DomDocument; @@ -137,7 +138,6 @@ public function __construct($type, $value = null) * Return the object as an array for usage in the XML * * @param DomDocument $document - * @param string $prefix * * @return DomElement * diff --git a/src/Bpost/Order/Box/Option/Messaging.php b/src/Bpost/Order/Box/Option/Messaging.php index 6e6a085f..4cb4447b 100644 --- a/src/Bpost/Order/Box/Option/Messaging.php +++ b/src/Bpost/Order/Box/Option/Messaging.php @@ -2,6 +2,7 @@ namespace Bpost\BpostApiClient\Bpost\Order\Box\Option; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Common\XmlHelper; use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException; use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; @@ -236,7 +237,7 @@ public static function createFromXML(SimpleXMLElement $xml) { $messaging = new Messaging($xml->getName(), (string) $xml->attributes()->language); - $children = $xml->children('http://schema.post.be/shm/deepintegration/v3/common'); + $children = $xml->children(Bpost::NS_V3_COMMON); if ((string) $children->emailAddress !== '') { $messaging->setEmailAddress((string) $children->emailAddress); } diff --git a/tests/Bpost/Order/Box/AtHomeTest.php b/tests/Bpost/Order/Box/AtHomeTest.php index a4086412..bb7310b0 100644 --- a/tests/Bpost/Order/Box/AtHomeTest.php +++ b/tests/Bpost/Order/Box/AtHomeTest.php @@ -2,6 +2,7 @@ namespace Tests\Bpost\Order\Box; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box\AtHome; use Bpost\BpostApiClient\Bpost\Order\Receiver; @@ -36,30 +37,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/Bpost/Order/Box/BpostOnAppointmentTest.php b/tests/Bpost/Order/Box/BpostOnAppointmentTest.php index 6e84df5d..3f528ebf 100644 --- a/tests/Bpost/Order/Box/BpostOnAppointmentTest.php +++ b/tests/Bpost/Order/Box/BpostOnAppointmentTest.php @@ -2,6 +2,7 @@ namespace Tests\Bpost\Order\Box; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box\BpostOnAppointment; use Bpost\BpostApiClient\Bpost\Order\Receiver; @@ -34,30 +35,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/Bpost/Order/Box/International/ParcelContentTest.php b/tests/Bpost/Order/Box/International/ParcelContentTest.php index 6c963a97..a01e765c 100644 --- a/tests/Bpost/Order/Box/International/ParcelContentTest.php +++ b/tests/Bpost/Order/Box/International/ParcelContentTest.php @@ -2,6 +2,7 @@ namespace Tests\Bpost\Order\Box\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Box\International\ParcelContent; use DOMDocument; use PHPUnit_Framework_TestCase; @@ -47,10 +48,7 @@ public function testToXML() $expectedDocument = self::createDomDocument(); $parcelContentDom = $parcelContent->toXML($expectedDocument, 'international'); $expectedDocument->appendChild($parcelContentDom); - $parcelContentDom->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); + $parcelContentDom->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); $this->assertSame($this->getXml(), $expectedDocument->saveXML()); } diff --git a/tests/Bpost/Order/Box/NationalTest.php b/tests/Bpost/Order/Box/NationalTest.php index 82a4e3f0..51252b60 100644 --- a/tests/Bpost/Order/Box/NationalTest.php +++ b/tests/Bpost/Order/Box/NationalTest.php @@ -2,6 +2,7 @@ namespace Tests\Bpost\Order\Box; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Box\National; use Bpost\BpostApiClient\Bpost\Order\Box\OpeningHour\Day; use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging; @@ -165,30 +166,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v3/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v3/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v3/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v3/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v3/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V3_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V3_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V3_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V3_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V3_GLOBAL); $document->appendChild($element); diff --git a/tests/Bpost/Order/Box/Option/InsuranceTest.php b/tests/Bpost/Order/Box/Option/InsuranceTest.php index 759020df..f98202eb 100644 --- a/tests/Bpost/Order/Box/Option/InsuranceTest.php +++ b/tests/Bpost/Order/Box/Option/InsuranceTest.php @@ -2,6 +2,7 @@ namespace Tests\Bpost\Order\Box\Option; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order\Box\Option\Insured; use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; use DOMDocument; @@ -34,30 +35,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/Bpost/OrderTest.php b/tests/Bpost/OrderTest.php index 3ba99624..8b218613 100644 --- a/tests/Bpost/OrderTest.php +++ b/tests/Bpost/OrderTest.php @@ -2,6 +2,7 @@ namespace Tests\Bpost; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -323,30 +324,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/BpostApiExamples/CreateOrder/International/BpackEuropeBusinessSecondPresentationAndAdditionalInsurance3Test.php b/tests/BpostApiExamples/CreateOrder/International/BpackEuropeBusinessSecondPresentationAndAdditionalInsurance3Test.php index f95b0f7a..6eb8578e 100644 --- a/tests/BpostApiExamples/CreateOrder/International/BpackEuropeBusinessSecondPresentationAndAdditionalInsurance3Test.php +++ b/tests/BpostApiExamples/CreateOrder/International/BpackEuropeBusinessSecondPresentationAndAdditionalInsurance3Test.php @@ -2,6 +2,7 @@ namespace Tests\BpostApiExamples\CreateOrder\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -180,30 +181,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/BpostApiExamples/CreateOrder/International/BpackEuropeBusinessSecondPresentationAndBasicInsuranceTest.php b/tests/BpostApiExamples/CreateOrder/International/BpackEuropeBusinessSecondPresentationAndBasicInsuranceTest.php index 7a3eca56..59ef883f 100644 --- a/tests/BpostApiExamples/CreateOrder/International/BpackEuropeBusinessSecondPresentationAndBasicInsuranceTest.php +++ b/tests/BpostApiExamples/CreateOrder/International/BpackEuropeBusinessSecondPresentationAndBasicInsuranceTest.php @@ -2,6 +2,7 @@ namespace Tests\BpostApiExamples\CreateOrder\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -178,30 +179,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessAdditionalInsurance3Test.php b/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessAdditionalInsurance3Test.php index f7908085..ff811dea 100644 --- a/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessAdditionalInsurance3Test.php +++ b/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessAdditionalInsurance3Test.php @@ -2,6 +2,7 @@ namespace Tests\BpostApiExamples\CreateOrder\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -220,30 +221,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessBasicInsuranceTest.php b/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessBasicInsuranceTest.php index cb604702..634cc756 100644 --- a/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessBasicInsuranceTest.php +++ b/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessBasicInsuranceTest.php @@ -2,6 +2,7 @@ namespace Tests\BpostApiExamples\CreateOrder\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -218,30 +219,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessNoOptionsTest.php b/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessNoOptionsTest.php index ebf299eb..e8701d26 100644 --- a/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessNoOptionsTest.php +++ b/tests/BpostApiExamples/CreateOrder/International/BpackWorldBusinessNoOptionsTest.php @@ -2,6 +2,7 @@ namespace Tests\BpostApiExamples\CreateOrder\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -210,30 +211,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/BpostApiExamples/CreateOrder/International/BpackWorldEasyReturnNoOptionsTest.php b/tests/BpostApiExamples/CreateOrder/International/BpackWorldEasyReturnNoOptionsTest.php index 2f9ff478..52a4d6a3 100644 --- a/tests/BpostApiExamples/CreateOrder/International/BpackWorldEasyReturnNoOptionsTest.php +++ b/tests/BpostApiExamples/CreateOrder/International/BpackWorldEasyReturnNoOptionsTest.php @@ -2,6 +2,7 @@ namespace Tests\BpostApiExamples\CreateOrder\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -166,30 +167,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProAdditionalInsurance3Test.php b/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProAdditionalInsurance3Test.php index 0ba35b46..6a89e454 100644 --- a/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProAdditionalInsurance3Test.php +++ b/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProAdditionalInsurance3Test.php @@ -2,6 +2,7 @@ namespace Tests\BpostApiExamples\CreateOrder\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -220,30 +221,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProBasicInsuranceTest.php b/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProBasicInsuranceTest.php index 81a7fee0..658e43aa 100644 --- a/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProBasicInsuranceTest.php +++ b/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProBasicInsuranceTest.php @@ -2,6 +2,7 @@ namespace Tests\BpostApiExamples\CreateOrder\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -218,30 +219,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element); diff --git a/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProNoOptionsTest.php b/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProNoOptionsTest.php index b50f5cd6..2ad0b133 100644 --- a/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProNoOptionsTest.php +++ b/tests/BpostApiExamples/CreateOrder/International/BpackWorldExpressProNoOptionsTest.php @@ -2,6 +2,7 @@ namespace Tests\BpostApiExamples\CreateOrder\International; +use Bpost\BpostApiClient\Bpost; use Bpost\BpostApiClient\Bpost\Order; use Bpost\BpostApiClient\Bpost\Order\Address; use Bpost\BpostApiClient\Bpost\Order\Box; @@ -210,30 +211,12 @@ private function createDomDocument() */ private function generateDomDocument(DOMDocument $document, DOMElement $element) { - $element->setAttribute( - 'xmlns:common', - 'http://schema.post.be/shm/deepintegration/v5/common' - ); - $element->setAttribute( - 'xmlns:tns', - 'http://schema.post.be/shm/deepintegration/v5/' - ); - $element->setAttribute( - 'xmlns', - 'http://schema.post.be/shm/deepintegration/v5/national' - ); - $element->setAttribute( - 'xmlns:international', - 'http://schema.post.be/shm/deepintegration/v5/international' - ); - $element->setAttribute( - 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' - ); - $element->setAttribute( - 'xsi:schemaLocation', - 'http://schema.post.be/shm/deepintegration/v5/' - ); + $element->setAttribute('xmlns:common', Bpost::NS_V5_COMMON); + $element->setAttribute('xmlns:tns', Bpost::NS_V5_GLOBAL); + $element->setAttribute('xmlns', Bpost::NS_V5_NATIONAL); + $element->setAttribute('xmlns:international', Bpost::NS_V5_INTERNATIONAL); + $element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $element->setAttribute('xsi:schemaLocation', Bpost::NS_V5_GLOBAL); $document->appendChild($element);