Skip to content

Commit df62fbd

Browse files
committed
Merge remote-tracking branch 'l3/ACP2E-459' into PR_L3_18_04_2022
2 parents a034337 + 71e15a3 commit df62fbd

File tree

3 files changed

+78
-7
lines changed

3 files changed

+78
-7
lines changed

app/code/Magento/Wishlist/Helper/Data.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
2828
/**
2929
* Config key 'Display Wishlist Summary'
3030
*/
31-
const XML_PATH_WISHLIST_LINK_USE_QTY = 'wishlist/wishlist_link/use_qty';
31+
public const XML_PATH_WISHLIST_LINK_USE_QTY = 'wishlist/wishlist_link/use_qty';
3232

3333
/**
3434
* Config key 'Display Out of Stock Products'
3535
*/
36-
const XML_PATH_CATALOGINVENTORY_SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
36+
public const XML_PATH_CATALOGINVENTORY_SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
3737

3838
/**
3939
* Currently logged in customer
@@ -64,7 +64,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
6464
protected $_wishlistItemCollection;
6565

6666
/**
67-
* Core registry
67+
* Magento framework Core registry
6868
*
6969
* @var \Magento\Framework\Registry
7070
*/
@@ -322,7 +322,8 @@ public function getConfigureUrl($item)
322322
'wishlist/index/configure',
323323
[
324324
'id' => $item->getWishlistItemId(),
325-
'product_id' => $item->getProductId()
325+
'product_id' => $item->getProductId(),
326+
'qty' => (int)$item->getQty()
326327
]
327328
);
328329
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontWishlistConfigureProductQtyTest">
12+
<annotations>
13+
<features value="Wishlist"/>
14+
<stories value="The qty should get updated in the wishlist product detail page as per the wishlist page."/>
15+
<title value="The qty in the wishlist product detail page should get updated as per the wishlist item on the wishlist page."/>
16+
<description value="The qty in the wishlist product detail page should get updated as per the wishlist item on the wishlist page."/>
17+
<testCaseId value="AC-2555"/>
18+
<useCaseId value="ACP2E-459"/>
19+
<severity value="AVERAGE"/>
20+
<group value="wishlist"/>
21+
</annotations>
22+
<before>
23+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
24+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
25+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
26+
<argument name="Customer" value="$$createCustomer$$"/>
27+
</actionGroup>
28+
</before>
29+
<after>
30+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutStorefront"/>
31+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
32+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
33+
</after>
34+
<!-- See the product page main section -->
35+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnProductPage"/>
36+
37+
<!-- Add product to wishlist -->
38+
<actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" stepKey="addProductToWishlist">
39+
<argument name="productVar" value="$$createProduct$$"/>
40+
</actionGroup>
41+
42+
<!-- Check if product available in wishlist -->
43+
<actionGroup ref="StorefrontCustomerCheckProductInWishlistActionGroup" stepKey="checkProductInWishlist">
44+
<argument name="productVar" value="$$createProduct$$"/>
45+
</actionGroup>
46+
47+
<!-- Edit wishlist product -->
48+
<actionGroup ref="StorefrontCustomerUpdateWishlistItemActionGroup" stepKey="clickEditWishlistItem">
49+
<argument name="productName" value="$$createProduct.name$$"/>
50+
</actionGroup>
51+
52+
<!-- Fill updated quantity to product info main section -->
53+
<fillField selector="{{StorefrontProductInfoMainSection.qty}}" userInput="1000" stepKey="fillQuantity"/>
54+
55+
<!-- Update wishlist with new quantity -->
56+
<click selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="clickUpdateWishlist"/>
57+
58+
<!-- Click edit wishlist product link again to redirect product info main section -->
59+
<actionGroup ref="StorefrontCustomerUpdateWishlistItemActionGroup" stepKey="clickEditWishlistItemAgain">
60+
<argument name="productName" value="$$createProduct.name$$"/>
61+
</actionGroup>
62+
63+
<!-- Verify that product info main section contains the updated quantity. -->
64+
<seeInField userInput="1000" selector="{{StorefrontProductInfoMainSection.qty}}" stepKey="seeUpdatedQuantity"/>
65+
</test>
66+
</tests>

app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ public function testGetAddToCartUrl()
184184

185185
public function testGetConfigureUrl()
186186
{
187-
$url = 'http://magento2ce/wishlist/index/configure/id/4/product_id/30/';
187+
$url = 'http://magento2ce/wishlist/index/configure/id/4/product_id/30/qty/1000';
188188

189189
/** @var WishlistItem|MockObject $wishlistItem */
190190
$wishlistItem = $this->getMockBuilder(WishlistItem::class)
191-
->addMethods(['getWishlistItemId', 'getProductId'])
191+
->addMethods(['getWishlistItemId', 'getProductId', 'getQty'])
192192
->disableOriginalConstructor()
193193
->getMock();
194194
$wishlistItem
@@ -199,10 +199,14 @@ public function testGetConfigureUrl()
199199
->expects($this->once())
200200
->method('getProductId')
201201
->willReturn(30);
202+
$wishlistItem
203+
->expects($this->once())
204+
->method('getQty')
205+
->willReturn(1000);
202206

203207
$this->urlBuilder->expects($this->once())
204208
->method('getUrl')
205-
->with('wishlist/index/configure', ['id' => 4, 'product_id' => 30])
209+
->with('wishlist/index/configure', ['id' => 4, 'product_id' => 30, 'qty' => 1000])
206210
->willReturn($url);
207211

208212
$this->assertEquals($url, $this->model->getConfigureUrl($wishlistItem));

0 commit comments

Comments
 (0)