Skip to content

Commit 3d7e33d

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into MC-16249
2 parents 1e6f8bc + f9a487d commit 3d7e33d

File tree

94 files changed

+1573
-522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1573
-522
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function updateValues(array $valuesToUpdate, array $oldValues): bool
129129
{
130130
$isChanged = false;
131131
foreach ($valuesToUpdate as $key => $value) {
132-
if ((!empty($value['value'])
132+
if ((($value['value'])!== null
133133
&& (float)$oldValues[$key]['price'] !== $this->localeFormat->getNumber($value['value'])
134134
) || $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value)
135135
) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontProductDetailPageNameAndUrlActionGroup">
12+
<annotations>
13+
<description>Validates that the Product name and Url are correct.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" defaultValue="{{ApiSimpleProduct.name}}" type="string"/>
17+
<argument name="productUrl" defaultValue="{{ApiSimpleProduct.urlKey}}" type="string"/>
18+
</arguments>
19+
20+
<seeInCurrentUrl url="{{StorefrontProductPage.url(productUrl)}}" stepKey="checkUrl"/>
21+
<seeInTitle userInput="{{productName}}" stepKey="assertProductNameTitle"/>
22+
<see userInput="{{productName}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/>
23+
</actionGroup>
24+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
<argument name="product"/>
1717
</arguments>
1818

19+
<waitForElementVisible selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="waitForProduct"/>
1920
<seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/>
2021
<see userInput="${{product.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/>
21-
<!-- @TODO: MAGETWO-80272 Move to Magento_Checkout -->
2222
<moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/>
23-
<!-- @TODO: MAGETWO-80272 Move to Magento_Checkout -->
2423
<seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/>
2524
</actionGroup>
2625
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontOpenProductFromCategoryPageActionGroup">
11+
<annotations>
12+
<description>Click on the provided product on category page.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="productName" type="string" defaultValue="{{ApiSimpleProduct.name}}"/>
16+
</arguments>
17+
18+
<click selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo(productName)}}" stepKey="openProductPage"/>
19+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ConstData.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616
<entity name="prodNameWithSpecChars">
1717
<data key="trademark">"Pursuit Lumaflex™ Tone Band"</data>
1818
<data key="skumark">"x™"</data>
19+
<data key="trademark_without_quotes">Pursuit Lumaflex™ Tone Band</data>
20+
<data key="skumark_without_quotes">x™</data>
1921
</entity>
2022
</entities>

app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
<element name="sectionHeader" type="button" selector="div[data-index='assign_products']" timeout="30"/>
1313
<element name="addProducts" type="button" selector="#catalog_category_add_product_tabs" timeout="30"/>
1414
<element name="addProductsDisabled" type="button" selector="#catalog_category_add_product_tabs[disabled]" timeout="30"/>
15+
<element name="productsInCategorySectionTitle" type="text" selector="div[data-index='assign_products'] .fieldset-wrapper-title" timeout="10"/>
16+
<element name="productsInCategorySectionBody" type="text" selector="div[data-index='assign_products'] .admin__fieldset-wrapper-content"/>
1517
</section>
16-
</sections>
18+
</sections>

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
<testCaseId value="MC-14714"/>
1616
<severity value="CRITICAL"/>
1717
<group value="mtf_migrated"/>
18-
<skip>
19-
<issueId value="MC-30409"/>
20-
</skip>
2118
</annotations>
2219

2320
<before>
2421
<createData entity="SubCategory" stepKey="category"/>
2522
<createData entity="Two_nested_categories" stepKey="subCategory">
2623
<requiredEntity createDataKey="category"/>
2724
</createData>
25+
<magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="enableGenerateUrlRewrite"/>
2826
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
2927
</before>
3028

app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php

Lines changed: 116 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
namespace Magento\Catalog\Test\Unit\Model\Attribute\Backend\TierPrice;
99

10-
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
11-
use Magento\Catalog\Model\Product\Attribute\Backend\TierPrice\UpdateHandler;
12-
use Magento\Store\Model\StoreManagerInterface;
1310
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
11+
use Magento\Catalog\Model\Product\Attribute\Backend\TierPrice\UpdateHandler;
12+
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice;
1413
use Magento\Customer\Api\GroupManagementInterface;
1514
use Magento\Framework\EntityManager\MetadataPool;
16-
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice;
15+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
16+
use Magento\Store\Model\StoreManagerInterface;
1717

1818
/**
1919
* Unit tests for \Magento\Catalog\Model\Product\Attribute\Backend\TierPrice\UpdateHandler
@@ -95,20 +95,27 @@ protected function setUp()
9595
);
9696
}
9797

98-
public function testExecute(): void
99-
{
100-
$newTierPrices = [
101-
['website_id' => 0, 'price_qty' => 2, 'cust_group' => 0, 'price' => 15],
102-
['website_id' => 0, 'price_qty' => 3, 'cust_group' => 3200, 'price' => null, 'percentage_value' => 20]
103-
];
104-
$priceIdToDelete = 2;
105-
$originalTierPrices = [
106-
['price_id' => 1, 'website_id' => 0, 'price_qty' => 2, 'cust_group' => 0, 'price' => 10],
107-
['price_id' => $priceIdToDelete, 'website_id' => 0, 'price_qty' => 4, 'cust_group' => 0, 'price' => 20],
108-
];
109-
$linkField = 'entity_id';
110-
$productId = 10;
111-
$originalProductId = 11;
98+
/**
99+
* Verify update handle.
100+
*
101+
* @param array $newTierPrices
102+
* @param array $originalTierPrices
103+
* @param int $priceIdToDelete
104+
* @param string $linkField
105+
* @param int $productId
106+
* @param int $originalProductId
107+
* @throws \Magento\Framework\Exception\InputException
108+
*
109+
* @dataProvider configDataProvider
110+
*/
111+
public function testExecute(
112+
$newTierPrices,
113+
$originalTierPrices,
114+
$priceIdToDelete,
115+
$linkField,
116+
$productId,
117+
$originalProductId
118+
): void {
112119

113120
/** @var \PHPUnit_Framework_MockObject_MockObject $product */
114121
$product = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class)
@@ -128,8 +135,12 @@ public function testExecute(): void
128135
['entity_id', $originalProductId]
129136
]
130137
);
138+
131139
$product->expects($this->atLeastOnce())->method('getStoreId')->willReturn(0);
132-
$product->expects($this->atLeastOnce())->method('setData')->with('tier_price_changed', 1);
140+
141+
$product->expects($this->atLeastOnce())
142+
->method('setData')
143+
->with('tier_price_changed', 1);
133144
$store = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)
134145
->disableOriginalConstructor()
135146
->setMethods(['getWebsiteId'])
@@ -163,11 +174,12 @@ public function testExecute(): void
163174
$this->tierPriceResource->expects($this->exactly(2))->method('savePriceData')->willReturnSelf();
164175
$this->tierPriceResource->expects($this->once())->method('deletePriceData')
165176
->with($productId, null, $priceIdToDelete);
166-
167177
$this->assertEquals($product, $this->updateHandler->execute($product));
168178
}
169179

170180
/**
181+
* Verify update handle with exception.
182+
*
171183
* @expectedException \Magento\Framework\Exception\InputException
172184
* @expectedExceptionMessage Tier prices data should be array, but actually other type is received
173185
*/
@@ -190,4 +202,88 @@ public function testExecuteWithException(): void
190202

191203
$this->updateHandler->execute($product);
192204
}
205+
206+
/**
207+
* Returns test parameters.
208+
*
209+
* @return array
210+
*/
211+
public function configDataProvider()
212+
{
213+
return [
214+
[
215+
[
216+
[
217+
'website_id' => 0,
218+
'price_qty' => 2,
219+
'cust_group' => 0,
220+
'price' => 15
221+
],
222+
[
223+
'website_id' => 0,
224+
'price_qty' => 3,
225+
'cust_group' => 3200,
226+
'price' => null,
227+
'percentage_value' => 20
228+
]
229+
],
230+
[
231+
[
232+
'price_id' => 1,
233+
'website_id' => 0,
234+
'price_qty' => 2,
235+
'cust_group' => 0,
236+
'price' => 10],
237+
[
238+
'price_id' => 2,
239+
'website_id' => 0,
240+
'price_qty' => 4,
241+
'cust_group' => 0,
242+
'price' => 20
243+
],
244+
],
245+
2,
246+
'entity_id',
247+
10,
248+
11
249+
],
250+
[
251+
[
252+
[
253+
'website_id' => 0,
254+
'price_qty' => 2,
255+
'cust_group' => 0,
256+
'price' => 0
257+
],
258+
[
259+
'website_id' => 0,
260+
'price_qty' => 3,
261+
'cust_group' => 3200,
262+
'price' => null,
263+
'percentage_value' => 20
264+
]
265+
],
266+
[
267+
[
268+
'price_id' => 1,
269+
'website_id' => 0,
270+
'price_qty' => 2,
271+
'cust_group' => 0,
272+
'price' => 10
273+
],
274+
[
275+
'price_id' => 2,
276+
'website_id' => 0,
277+
'price_qty' => 4,
278+
'cust_group' => 0,
279+
'price' => 20
280+
],
281+
],
282+
2,
283+
'entity_id',
284+
10,
285+
11
286+
]
287+
];
288+
}
193289
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCatalogPriceRuleAddSkuConditionActionGroup">
11+
<annotations>
12+
<description>Create new product SKU based condition in Catalog Price Rule form.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="productSku" type="string" defaultValue="{{ApiSimpleTwo.sku}}"/>
16+
</arguments>
17+
18+
<conditionalClick selector="{{AdminNewCatalogPriceRule.conditionsTabTitle}}" dependentSelector="{{AdminNewCatalogPriceRule.conditionsTabBody}}" visible="false" stepKey="openConditionsSectionIfNeeded"/>
19+
<scrollTo selector="{{AdminNewCatalogPriceRule.conditionsTabTitle}}" stepKey="scrollToConditionsFieldset"/>
20+
<waitForElementVisible selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="waitForNewConditionButton"/>
21+
<click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="clickAddNewConditionButton"/>
22+
<selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="Magento\CatalogRule\Model\Rule\Condition\Product|sku" stepKey="selectConditionTypeSku"/>
23+
<waitForPageLoad stepKey="waitConditionFormRefresh"/>
24+
<click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsis('1')}}" stepKey="clickEllipsis"/>
25+
<fillField selector="{{AdminNewCatalogPriceRuleConditions.targetInput('1', '1')}}" userInput="{{productSku}}" stepKey="fillProductSku"/>
26+
<click selector="{{AdminNewCatalogPriceRuleConditions.applyButton('1', '1')}}" stepKey="clickApply"/>
27+
</actionGroup>
28+
</actionGroups>

app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
<!-- action group to create a new catalog price rule giving a catalogRule entity -->
1212
<actionGroup name="NewCatalogPriceRuleByUIActionGroup">
1313
<annotations>
14-
<description>Goes to the Catalog Price Rule grid. Clicks on Add. Fills in the provided Catalog Rule details.</description>
14+
<description>DEPRECATED. Please use set of AG: AdminOpenNewCatalogPriceRuleFormPageActionGroup, AdminCatalogPriceRuleFillMainInfoActionGroup, AdminCatalogPriceRuleFillActionsActionGroup, AdminCatalogPriceRuleSaveAndApplyActionGroup
15+
Goes to the Catalog Price Rule grid. Clicks on Add. Fills in the provided Catalog Rule details.</description>
1516
</annotations>
1617
<arguments>
1718
<argument name="catalogRule" defaultValue="_defaultCatalogRule"/>

0 commit comments

Comments
 (0)