Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #12905: [Backport #12666 into 2.3-develop] Fix incorrect DHL Product codes (by @gwharton)
 - #12896: Add product ID and SKU to wishlist customer data (by @jameshalsall)
  • Loading branch information
magento-team authored Jan 3, 2018
2 parents ed0a849 + 4870115 commit ccf68bb
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/code/Magento/Dhl/Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ public function getDhlProducts($doc)
'L' => __('Express 10:30'),
'G' => __('Domestic economy select'),
'W' => __('Economy select'),
'I' => __('Break bulk economy'),
'I' => __('Domestic express 9:00'),
'N' => __('Domestic express'),
'O' => __('Others'),
'R' => __('Globalmail business'),
Expand All @@ -616,7 +616,7 @@ public function getDhlProducts($doc)
];

$nonDocType = [
'1' => __('Customer services'),
'1' => __('Domestic express 12:00'),
'3' => __('Easy shop'),
'4' => __('Jetline'),
'8' => __('Express easy'),
Expand Down
63 changes: 63 additions & 0 deletions app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,67 @@ public function requestToShipmentDataProvider()
]
];
}

/**
* @dataProvider dhlProductsDataProvider
*
* @param string $docType
* @param array $products
*/
public function testGetDhlProducts(string $docType, array $products)
{
$this->assertEquals($products, $this->model->getDhlProducts($docType));
}

/**
* @return array
*/
public function dhlProductsDataProvider() : array
{
return [
'doc' => [
'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_DOC,
'products' => [
'2' => 'Easy shop',
'5' => 'Sprintline',
'6' => 'Secureline',
'7' => 'Express easy',
'9' => 'Europack',
'B' => 'Break bulk express',
'C' => 'Medical express',
'D' => 'Express worldwide',
'U' => 'Express worldwide',
'K' => 'Express 9:00',
'L' => 'Express 10:30',
'G' => 'Domestic economy select',
'W' => 'Economy select',
'I' => 'Domestic express 9:00',
'N' => 'Domestic express',
'O' => 'Others',
'R' => 'Globalmail business',
'S' => 'Same day',
'T' => 'Express 12:00',
'X' => 'Express envelope',
]
],
'non-doc' => [
'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_NON_DOC,
'products' => [
'1' => 'Domestic express 12:00',
'3' => 'Easy shop',
'4' => 'Jetline',
'8' => 'Express easy',
'P' => 'Express worldwide',
'Q' => 'Medical express',
'E' => 'Express 9:00',
'F' => 'Freight worldwide',
'H' => 'Economy select',
'J' => 'Jumbo box',
'M' => 'Express 10:30',
'V' => 'Europack',
'Y' => 'Express 12:00',
]
]
];
}
}
4 changes: 2 additions & 2 deletions app/code/Magento/Dhl/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ Europack,Europack
"Express 10:30","Express 10:30"
"Domestic economy select","Domestic economy select"
"Economy select","Economy select"
"Break bulk economy","Break bulk economy"
"Domestic express","Domestic express"
Others,Others
"Globalmail business","Globalmail business"
"Same day","Same day"
"Express 12:00","Express 12:00"
"Express envelope","Express envelope"
"Customer services","Customer services"
Jetline,Jetline
"Freight worldwide","Freight worldwide"
"Jumbo box","Jumbo box"
Expand Down Expand Up @@ -81,3 +79,5 @@ Size,Size
"Show Method if Not Applicable","Show Method if Not Applicable"
"Sort Order","Sort Order"
Debug,Debug
"Domestic express 9:00","Domestic express 9:00"
"Domestic express 12:00","Domestic express 12:00"
2 changes: 2 additions & 0 deletions app/code/Magento/Wishlist/CustomerData/Wishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem)
$product = $wishlistItem->getProduct();
return [
'image' => $this->getImageData($product),
'product_sku' => $product->getSku(),
'product_id' => $product->getId(),
'product_url' => $this->wishlistHelper->getProductUrl($wishlistItem),
'product_name' => $product->getName(),
'product_price' => $this->block->getProductPriceHtml(
Expand Down
24 changes: 24 additions & 0 deletions app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public function testGetSectionData()
$imageLabel = 'image_label';
$imageWidth = 'image_width';
$imageHeight = 'image_height';
$productSku = 'product_sku';
$productId = 'product_id';
$productUrl = 'product_url';
$productName = 'product_name';
$productPrice = 'product_price';
Expand All @@ -97,6 +99,8 @@ public function testGetSectionData()
'width' => $imageWidth,
'height' => $imageHeight,
],
'product_sku' => $productSku,
'product_id' => $productId,
'product_url' => $productUrl,
'product_name' => $productName,
'product_price' => $productPrice,
Expand Down Expand Up @@ -186,6 +190,12 @@ public function testGetSectionData()
->with($itemMock, [])
->willReturn($productUrl);

$productMock->expects($this->once())
->method('getSku')
->willReturn($productSku);
$productMock->expects($this->once())
->method('getId')
->willReturn($productId);
$productMock->expects($this->once())
->method('getName')
->willReturn($productName);
Expand Down Expand Up @@ -246,6 +256,8 @@ public function testGetSectionDataWithTwoItems()
$imageLabel = 'image_label';
$imageWidth = 'image_width';
$imageHeight = 'image_height';
$productSku = 'product_sku';
$productId = 'product_id';
$productUrl = 'product_url';
$productName = 'product_name';
$productPrice = 'product_price';
Expand All @@ -272,6 +284,8 @@ public function testGetSectionDataWithTwoItems()
'width' => $imageWidth,
'height' => $imageHeight,
],
'product_sku' => $productSku,
'product_id' => $productId,
'product_url' => $productUrl,
'product_name' => $productName,
'product_price' => $productPrice,
Expand All @@ -288,6 +302,8 @@ public function testGetSectionDataWithTwoItems()
'width' => $imageWidth,
'height' => $imageHeight,
],
'product_sku' => $productSku,
'product_id' => $productId,
'product_url' => $productUrl,
'product_name' => $productName,
'product_price' => $productPrice,
Expand Down Expand Up @@ -375,6 +391,14 @@ public function testGetSectionDataWithTwoItems()
->method('getName')
->willReturn($productName);

$productMock->expects($this->exactly(2))
->method('getId')
->willReturn($productId);

$productMock->expects($this->exactly(2))
->method('getSku')
->willReturn($productSku);

$this->sidebarMock->expects($this->exactly(2))
->method('getProductPriceHtml')
->with(
Expand Down

0 comments on commit ccf68bb

Please sign in to comment.