diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml
index df229c4b6ed78..ffbd6152af80b 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml
@@ -58,6 +58,11 @@
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml
index 3c090900563a5..714a06510952f 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml
@@ -94,7 +94,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml
index eff18f9081b67..cd6f4215adb5d 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml
@@ -88,7 +88,7 @@
-
+
diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php
index 9781b521597ba..513e15c2a4dc4 100644
--- a/app/code/Magento/Dhl/Model/Carrier.php
+++ b/app/code/Magento/Dhl/Model/Carrier.php
@@ -1756,7 +1756,7 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
foreach ($package['items'] as $item) {
$content[] = $item['name'];
}
- $nodePiece->addChild('PieceContents', substr(implode(',', $content), 0, 34));
+ $nodePiece->addChild('PieceContents', $this->string->substr(implode(',', $content), 0, 34));
}
$nodeShipmentDetails->addChild('Weight', sprintf('%.3f', $rawRequest->getPackageWeight()));
@@ -1776,7 +1776,7 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
$nodeShipmentDetails->addChild('DoorTo', 'DD');
$nodeShipmentDetails->addChild('DimensionUnit', substr($this->_getDimensionUnit(), 0, 1));
$contentType = isset($package['params']['container']) ? $package['params']['container'] : '';
- $packageType = $contentType === self::DHL_CONTENT_TYPE_NON_DOC ? 'CP' : '';
+ $packageType = $contentType === self::DHL_CONTENT_TYPE_NON_DOC ? 'CP' : 'EE';
$nodeShipmentDetails->addChild('PackageType', $packageType);
if ($this->isDutiable($rawRequest->getOrigCountryId(), $rawRequest->getDestCountryId())) {
$nodeShipmentDetails->addChild('IsDutiable', 'Y');
diff --git a/dev/tests/integration/testsuite/Magento/Dhl/Model/CarrierTest.php b/dev/tests/integration/testsuite/Magento/Dhl/Model/CarrierTest.php
index f9a1d2923e5be..552040489e253 100644
--- a/dev/tests/integration/testsuite/Magento/Dhl/Model/CarrierTest.php
+++ b/dev/tests/integration/testsuite/Magento/Dhl/Model/CarrierTest.php
@@ -17,19 +17,22 @@
use Magento\Quote\Model\Quote\Address\RateRequest;
use Magento\Quote\Model\Quote\Address\RateResult\Error;
use Magento\Shipping\Model\Shipment\Request;
+use Magento\Shipping\Model\Simplexml\Element as ShippingElement;
use Magento\Shipping\Model\Tracking\Result\Status;
use Magento\Store\Model\ScopeInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\HTTP\AsyncClientInterfaceMock;
-use Magento\Shipping\Model\Simplexml\Element as ShippingElement;
+use PHPUnit\Framework\TestCase;
/**
* Test for DHL integration.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class CarrierTest extends \PHPUnit\Framework\TestCase
+class CarrierTest extends TestCase
{
+ private const PRODUCT_NAME_SPECIAL_CHARS = 'Φυστίκι Ψημένο με Αλάτι Συσκευασία';
+
/**
* @var Carrier
*/
@@ -254,10 +257,16 @@ private function assertTrackingResult($expectedTrackingData, $trackingResults):
* @param string $origCountryId
* @param string $expectedRegionCode
* @param string $destCountryId
+ * @param bool|null $isProductNameContainsSpecialChars
+ * @return void
* @dataProvider requestToShipmentDataProvider
*/
- public function testRequestToShip(string $origCountryId, string $expectedRegionCode, string $destCountryId): void
- {
+ public function testRequestToShip(
+ string $origCountryId,
+ string $expectedRegionCode,
+ string $destCountryId,
+ bool $isProductNameContainsSpecialChars = false
+ ): void {
$this->config->setValue(
'shipping/origin/country_id',
$origCountryId,
@@ -274,6 +283,8 @@ public function testRequestToShip(string $origCountryId, string $expectedRegionC
)
]
);
+ $productName = $isProductNameContainsSpecialChars ? self::PRODUCT_NAME_SPECIAL_CHARS : 'item_name';
+
//phpcs:enable Magento2.Functions.DiscouragedFunction
$request = new Request(
[
@@ -291,7 +302,7 @@ public function testRequestToShip(string $origCountryId, string $expectedRegionC
],
'items' => [
'item1' => [
- 'name' => 'item_name',
+ 'name' => $productName,
],
],
],
@@ -329,10 +340,15 @@ public function testRequestToShip(string $origCountryId, string $expectedRegionC
$requestElement->Request->ServiceHeader->MessageReference = 'MAGE_SHIP_28TO32_Char_CHECKED';
$requestElement->Request->ServiceHeader->MessageTime = 'currentTime';
$requestElement->ShipmentDetails->Date = 'currentTime';
- $this->assertXmlStringEqualsXmlString(
- $this->getExpectedLabelRequestXml($origCountryId, $destCountryId, $expectedRegionCode),
- $requestElement->asXML()
+
+ $expectedLabelRequest = $this->getExpectedLabelRequestXml(
+ $origCountryId,
+ $destCountryId,
+ $expectedRegionCode,
+ $isProductNameContainsSpecialChars
);
+
+ $this->assertXmlStringEqualsXmlString($expectedLabelRequest, $requestElement->asXML());
}
/**
@@ -351,7 +367,10 @@ public function requestToShipmentDataProvider(): array
],
[
'DE', 'EU', 'DE'
- ]
+ ],
+ [
+ 'GB', 'EU', 'US', true
+ ],
];
}
@@ -361,12 +380,14 @@ public function requestToShipmentDataProvider(): array
* @param string $origCountryId
* @param string $destCountryId
* @param string $regionCode
+ * @param bool $isProductNameContainsSpecialChars
* @return string
*/
private function getExpectedLabelRequestXml(
string $origCountryId,
string $destCountryId,
- string $regionCode
+ string $regionCode,
+ bool $isProductNameContainsSpecialChars
): string {
$countryNames = [
'US' => 'United States Of America',
@@ -387,6 +408,10 @@ private function getExpectedLabelRequestXml(
$expectedRequestElement->Shipper->CountryName = $countryNames[$origCountryId];
$expectedRequestElement->RegionCode = $regionCode;
+ if ($isProductNameContainsSpecialChars) {
+ $expectedRequestElement->ShipmentDetails->Pieces->Piece->PieceContents = self::PRODUCT_NAME_SPECIAL_CHARS;
+ }
+
return $expectedRequestElement->asXML();
}