Skip to content

Commit ed4c4ab

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into PB-48
2 parents dcdadbd + e90ddc6 commit ed4c4ab

File tree

6 files changed

+182
-25
lines changed

6 files changed

+182
-25
lines changed

app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,10 @@ public function getAllowProducts()
182182
{
183183
if (!$this->hasAllowProducts()) {
184184
$products = [];
185-
$skipSaleableCheck = $this->catalogProduct->getSkipSaleableCheck();
186185
$allProducts = $this->getProduct()->getTypeInstance()->getUsedProducts($this->getProduct(), null);
187186
/** @var $product \Magento\Catalog\Model\Product */
188187
foreach ($allProducts as $product) {
189-
if ($skipSaleableCheck || ((int) $product->getStatus()) === Status::STATUS_ENABLED) {
188+
if ((int) $product->getStatus() === Status::STATUS_ENABLED) {
190189
$products[] = $product;
191190
}
192191
}
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
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="NoOptionAvailableToConfigureDisabledProductTest">
12+
<annotations>
13+
<features value="ConfigurableProduct"/>
14+
<stories value="Admin order configurable product"/>
15+
<title value="Disabled variation of configurable product can't be added to shopping cart via admin"/>
16+
<description value="Disabled variation of configurable product can't be added to shopping cart via admin"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-17373"/>
19+
<useCaseId value="MAGETWO-72172"/>
20+
<group value="ConfigurableProduct"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
24+
<!--Create category-->
25+
<comment userInput="Create category" stepKey="commentCreateCategory"/>
26+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
27+
<!-- Create the configurable product based on the data in the data folder -->
28+
<comment userInput="Create the configurable product based on the data in the data folder" stepKey="createConfigurableProduct"/>
29+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
30+
<requiredEntity createDataKey="createCategory"/>
31+
</createData>
32+
<!-- Create the configurable product with two options based on the default attribute set -->
33+
<comment userInput="Create the configurable product with two options based on the default attribute set" stepKey="configurableProductWithTwoOptions"/>
34+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
35+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
36+
<requiredEntity createDataKey="createConfigProductAttribute"/>
37+
</createData>
38+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
39+
<requiredEntity createDataKey="createConfigProductAttribute"/>
40+
</createData>
41+
<createData entity="productAttributeOption3" stepKey="createConfigProductAttributeOption3">
42+
<requiredEntity createDataKey="createConfigProductAttribute"/>
43+
</createData>
44+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
45+
<requiredEntity createDataKey="createConfigProductAttribute"/>
46+
</createData>
47+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
48+
<requiredEntity createDataKey="createConfigProductAttribute"/>
49+
</getData>
50+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
51+
<requiredEntity createDataKey="createConfigProductAttribute"/>
52+
</getData>
53+
<getData entity="ProductAttributeOptionGetter" index="3" stepKey="getConfigAttributeOption3">
54+
<requiredEntity createDataKey="createConfigProductAttribute"/>
55+
</getData>
56+
<!-- Create the 3 children that will be a part of the configurable product -->
57+
<comment userInput="Create the 3 children that will be a part of the configurable product" stepKey="createTwoChildrenProducts"/>
58+
<createData entity="ApiSimpleProductWithPrice50" stepKey="createConfigChildProduct1">
59+
<requiredEntity createDataKey="createConfigProductAttribute"/>
60+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
61+
</createData>
62+
<createData entity="ApiSimpleProductWithPrice60" stepKey="createConfigChildProduct2">
63+
<requiredEntity createDataKey="createConfigProductAttribute"/>
64+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
65+
</createData>
66+
<createData entity="ApiSimpleProductWithPrice70" stepKey="createConfigChildProduct3">
67+
<requiredEntity createDataKey="createConfigProductAttribute"/>
68+
<requiredEntity createDataKey="getConfigAttributeOption3"/>
69+
</createData>
70+
<!-- Assign 3 products to the configurable product -->
71+
<comment userInput="Assign 3 products to the configurable product" stepKey="assignToConfigurableProduct"/>
72+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
73+
<requiredEntity createDataKey="createConfigProduct"/>
74+
<requiredEntity createDataKey="createConfigProductAttribute"/>
75+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
76+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
77+
<requiredEntity createDataKey="getConfigAttributeOption3"/>
78+
</createData>
79+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
80+
<requiredEntity createDataKey="createConfigProduct"/>
81+
<requiredEntity createDataKey="createConfigChildProduct1"/>
82+
</createData>
83+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
84+
<requiredEntity createDataKey="createConfigProduct"/>
85+
<requiredEntity createDataKey="createConfigChildProduct2"/>
86+
</createData>
87+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild3">
88+
<requiredEntity createDataKey="createConfigProduct"/>
89+
<requiredEntity createDataKey="createConfigChildProduct3"/>
90+
</createData>
91+
<!-- Create Customer -->
92+
<comment userInput="Create customer" stepKey="commentCreateCustomer"/>
93+
<createData entity="Simple_US_Customer_CA" stepKey="createCustomer"/>
94+
</before>
95+
<after>
96+
<!-- Delete created data -->
97+
<comment userInput="Delete created data" stepKey="deleteData"/>
98+
<deleteData createDataKey="createCategory" stepKey="deleteCategory2"/>
99+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
100+
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
101+
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
102+
<deleteData createDataKey="createConfigChildProduct3" stepKey="deleteConfigChildProduct3"/>
103+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
104+
<deleteData createDataKey="createCustomer" stepKey="deleteCreatedCustomer"/>
105+
<actionGroup ref="logout" stepKey="logout"/>
106+
</after>
107+
<!-- Disable child product -->
108+
<comment userInput="Disable child product" stepKey="disableChildProduct"/>
109+
<amOnPage url="{{AdminProductEditPage.url($$createConfigChildProduct1.id$$)}}" stepKey="goToEditPage"/>
110+
<waitForPageLoad stepKey="waitForChildProductPageLoad"/>
111+
<click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="disableProduct"/>
112+
<actionGroup ref="saveProductForm" stepKey="saveProductForm"/>
113+
<!-- Set the second product out of stock -->
114+
<comment userInput="Set the second product out of stock" stepKey="outOfStockChildProduct"/>
115+
<amOnPage url="{{AdminProductEditPage.url($$createConfigChildProduct2.id$$)}}" stepKey="goToSecondProductEditPage"/>
116+
<waitForPageLoad stepKey="waitForSecondChildProductPageLoad"/>
117+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="Out of Stock" stepKey="outOfStockStatus"/>
118+
<actionGroup ref="saveProductForm" stepKey="saveSecondProductForm"/>
119+
<!-- Go to created customer page -->
120+
<comment userInput="Go to created customer page" stepKey="goToCreatedCustomerPage"/>
121+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="createNewOrder">
122+
<argument name="customer" value="$$createCustomer$$"/>
123+
</actionGroup>
124+
<click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickToAddProduct"/>
125+
<waitForPageLoad stepKey="waitForProductsOpened"/>
126+
<!-- Find created configurable product and click on "Configure" link -->
127+
<comment userInput="Find created configurable product and click on Configure link" stepKey="goToConfigurableLink"/>
128+
<click selector="{{AdminOrderFormConfigureProductSection.configure($$createConfigProduct.id$$)}}" stepKey="clickOnConfigure"/>
129+
<!-- Click on attribute drop-down and check no option 1 is available -->
130+
<comment userInput="Click on attribute drop-down and check no option 1 is available" stepKey="commentNoOptionIsAvailable"/>
131+
<waitForElement selector="{{AdminOrderFormConfigureProductSection.selectOption}}" stepKey="waitForShippingSectionLoaded"/>
132+
<click selector="{{AdminOrderFormConfigureProductSection.selectOption}}" stepKey="clickToSelectOption"/>
133+
<dontSee userInput="$$createConfigProductAttributeOption1.option[store_labels][1][label]$$" stepKey="dontSeeOption1"/>
134+
<!-- Go to created customer page again -->
135+
<comment userInput="Go to created customer page again" stepKey="goToCreatedCustomerPageAgain"/>
136+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="createNewOrderAgain">
137+
<argument name="customer" value="$$createCustomer$$"/>
138+
</actionGroup>
139+
<click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickToAddProductAgain"/>
140+
<waitForPageLoad stepKey="waitForProductsOpenedAgain"/>
141+
<fillField selector="{{AdminOrderFormItemsSection.idFilter}}" userInput="$$createConfigChildProduct2.id$$" stepKey="idFilter"/>
142+
<click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/>
143+
<checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectConfigurableProduct"/>
144+
<!-- Add product to order -->
145+
<comment userInput="Add product to order" stepKey="addProductToOrder"/>
146+
<waitForPageLoad stepKey="waitForPageLoad"/>
147+
<click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickToAddProductToOrder"/>
148+
<waitForPageLoad stepKey="waitForNewOrderPageLoad"/>
149+
<see userInput="This product is out of stock." stepKey="seeTheErrorMessageDisplayed"/>
150+
<!-- Select shipping method -->
151+
<comment userInput="Select shipping method" stepKey="selectShippingMethod"/>
152+
<click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/>
153+
<waitForPageLoad stepKey="waitForShippingMethods"/>
154+
<click selector="{{AdminInvoicePaymentShippingSection.shippingMethod}}" stepKey="chooseShippingMethod"/>
155+
<waitForPageLoad stepKey="waitForShippingMethodLoad"/>
156+
<click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder"/>
157+
<waitForPageLoad stepKey="waitForSuccess"/>
158+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage"/>
159+
</test>
160+
</tests>

app/code/Magento/ConfigurableProduct/Test/Unit/Block/Product/View/Type/ConfigurableTest.php

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,7 @@ public function cacheKeyProvider(): array
233233
public function testGetCacheKeyInfo(array $expected, string $priceCurrency = null, string $customerGroupId = null)
234234
{
235235
$storeMock = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)
236-
->setMethods([
237-
'getCurrentCurrency',
238-
])
236+
->setMethods(['getCurrentCurrency'])
239237
->getMockForAbstractClass();
240238
$storeMock->expects($this->any())
241239
->method('getCode')
@@ -270,9 +268,7 @@ public function testGetJsonConfig()
270268
$amountMock = $this->getAmountMock($amount);
271269

272270
$priceMock = $this->getMockBuilder(\Magento\Framework\Pricing\Price\PriceInterface::class)
273-
->setMethods([
274-
'getAmount',
275-
])
271+
->setMethods(['getAmount'])
276272
->getMockForAbstractClass();
277273
$priceMock->expects($this->any())->method('getAmount')->willReturn($amountMock);
278274
$tierPriceMock = $this->getTierPriceMock($amountMock, $priceQty, $percentage);
@@ -287,22 +283,25 @@ public function testGetJsonConfig()
287283
->getMock();
288284
$priceInfoMock->expects($this->any())
289285
->method('getPrice')
290-
->willReturnMap([
291-
['regular_price', $priceMock],
292-
['final_price', $priceMock],
293-
['tier_price', $tierPriceMock],
294-
]);
286+
->willReturnMap(
287+
[
288+
['regular_price', $priceMock],
289+
['final_price', $priceMock],
290+
['tier_price', $tierPriceMock],
291+
]
292+
);
295293

296294
$productMock->expects($this->any())->method('getTypeInstance')->willReturn($productTypeMock);
297295
$productMock->expects($this->any())->method('getPriceInfo')->willReturn($priceInfoMock);
298296
$productMock->expects($this->any())->method('isSaleable')->willReturn(true);
299297
$productMock->expects($this->any())->method('getId')->willReturn($productId);
298+
$productMock->expects($this->any())->method('getStatus')
299+
->willReturn(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);
300300

301301
$this->helper->expects($this->any())
302302
->method('getOptions')
303303
->with($productMock, [$productMock])
304304
->willReturn([]);
305-
$this->product->expects($this->any())->method('getSkipSaleableCheck')->willReturn(true);
306305

307306
$attributesData = [
308307
'attributes' => [],
@@ -421,9 +420,7 @@ private function getProductTypeMock(\PHPUnit_Framework_MockObject_MockObject $pr
421420
->willReturn('%s');
422421

423422
$storeMock = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)
424-
->setMethods([
425-
'getCurrentCurrency',
426-
])
423+
->setMethods(['getCurrentCurrency'])
427424
->getMockForAbstractClass();
428425
$storeMock->expects($this->any())
429426
->method('getCurrentCurrency')
@@ -475,10 +472,7 @@ protected function mockContextObject()
475472
protected function getAmountMock($amount): \PHPUnit_Framework_MockObject_MockObject
476473
{
477474
$amountMock = $this->getMockBuilder(\Magento\Framework\Pricing\Amount\AmountInterface::class)
478-
->setMethods([
479-
'getValue',
480-
'getBaseAmount',
481-
])
475+
->setMethods(['getValue', 'getBaseAmount'])
482476
->getMockForAbstractClass();
483477
$amountMock->expects($this->any())
484478
->method('getValue')
@@ -506,10 +500,7 @@ protected function getTierPriceMock(\PHPUnit_Framework_MockObject_MockObject $am
506500
];
507501

508502
$tierPriceMock = $this->getMockBuilder(\Magento\Catalog\Pricing\Price\TierPriceInterface::class)
509-
->setMethods([
510-
'getTierPriceList',
511-
'getSavePercent',
512-
])
503+
->setMethods(['getTierPriceList', 'getSavePercent'])
513504
->getMockForAbstractClass();
514505
$tierPriceMock->expects($this->any())
515506
->method('getTierPriceList')

app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474

7575
<!-- Save product -->
7676
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
77+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
78+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
7779

7880
<!-- Find downloadable product in grid -->
7981
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>

app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormConfigureProductSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminOrderFormConfigureProductSection">
12+
<element name="configure" type="button" selector="//a[@product_id='{{productId}}']" parameterized="true"/>
1213
<element name="optionSelect" type="select" selector="//div[contains(@class,'product-options')]//select[//label[text() = '{{option}}']]" parameterized="true"/>
1314
<element name="optionSelectNew" type="select" selector="//label[text()='{{option1}}']/following-sibling::div/select" parameterized="true"/>
1415
<element name="quantity" type="input" selector="#product_composite_configure_input_qty"/>

app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddProductsToCartFromWishlistUsingSidebarTest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@
2525
<createData entity="SimpleProduct" stepKey="simpleProduct2">
2626
<requiredEntity createDataKey="categorySecond"/>
2727
</createData>
28+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
29+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
2830
<createData entity="Simple_US_Customer" stepKey="customer"/>
2931
</before>
3032
<after>
3133
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
3234
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
3335
<deleteData createDataKey="categoryFirst" stepKey="deleteCategoryFirst"/>
3436
<deleteData createDataKey="categorySecond" stepKey="deleteCategorySecond"/>
37+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
38+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
3539
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
3640
</after>
3741
<!-- Sign in as customer -->

0 commit comments

Comments
 (0)