Skip to content

Commit f845305

Browse files
merge magento-commerce/2.4-develop into magento-performance/mcp-123
2 parents b0743c4 + f6c4e1c commit f845305

File tree

187 files changed

+4694
-695
lines changed

Some content is hidden

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

187 files changed

+4694
-695
lines changed

app/code/Magento/Authorization/Model/Rules.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,44 +25,30 @@
2525
class Rules extends \Magento\Framework\Model\AbstractModel
2626
{
2727
/**
28-
* Class constructor
29-
*
30-
* @param \Magento\Framework\Model\Context $context
31-
* @param \Magento\Framework\Registry $registry
32-
* @param \Magento\Authorization\Model\ResourceModel\Rules $resource
33-
* @param \Magento\Authorization\Model\ResourceModel\Rules\Collection $resourceCollection
34-
* @param array $data
35-
*/
36-
public function __construct(
37-
\Magento\Framework\Model\Context $context,
38-
\Magento\Framework\Registry $registry,
39-
\Magento\Authorization\Model\ResourceModel\Rules $resource,
40-
\Magento\Authorization\Model\ResourceModel\Rules\Collection $resourceCollection,
41-
array $data = []
42-
) {
43-
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
44-
}
45-
46-
/**
47-
* Class constructor
48-
*
49-
* @return void
28+
* @inheritdoc
5029
*/
5130
protected function _construct()
5231
{
5332
$this->_init(\Magento\Authorization\Model\ResourceModel\Rules::class);
5433
}
5534

5635
/**
36+
* Obsolete method of update
37+
*
5738
* @return $this
39+
* @deprecated Method was never implemented and used.
5840
*/
5941
public function update()
6042
{
61-
$this->getResource()->update($this);
43+
// phpcs:disable Magento2.Functions.DiscouragedFunction
44+
trigger_error('Method was never implemented and used.', E_USER_DEPRECATED);
45+
6246
return $this;
6347
}
6448

6549
/**
50+
* Save authorization rule relation
51+
*
6652
* @return $this
6753
*/
6854
public function saveRel()

app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@
5959
</actionGroup>
6060
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/>
6161
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts"/>
62+
<!-- Check that Bundle Options initialized with default quantity -->
63+
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantity"/>
64+
<assertEquals stepKey="assertFirstBundleOptionDefaultQuantity">
65+
<expectedResult type="string">1</expectedResult>
66+
<actualResult type="string">$grabbedFirstBundleOptionQuantity</actualResult>
67+
</assertEquals>
68+
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantity"/>
69+
<assertEquals stepKey="assertSecondBundleOptionDefaultQuantity">
70+
<expectedResult type="string">1</expectedResult>
71+
<actualResult type="string">$grabbedSecondBundleOptionQuantity</actualResult>
72+
</assertEquals>
73+
6274
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty1"/>
6375
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/>
6476

@@ -108,6 +120,17 @@
108120
</actionGroup>
109121
<checkOption selector="{{AdminProductFormBundleSection.firstProductOption}}" stepKey="selectNewFirstGridRow2"/>
110122
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddNewSelectedBundleProducts"/>
123+
<!-- Check that existing Bundle Options do not loose user input quantity values -->
124+
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantityAfterUserInput"/>
125+
<assertEquals stepKey="assertFirstBundleOptionDefaultQuantityAfterUserInput">
126+
<expectedResult type="string">{{BundleProduct.defaultQuantity}}</expectedResult>
127+
<actualResult type="string">$grabbedFirstBundleOptionQuantityAfterUserInput</actualResult>
128+
</assertEquals>
129+
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantityAfterUserInput"/>
130+
<assertEquals stepKey="assertSecondBundleOptionDefaultQuantityAfterUserInput">
131+
<expectedResult type="string">{{BundleProduct.defaultQuantity}}</expectedResult>
132+
<actualResult type="string">$grabbedSecondBundleOptionQuantityAfterUserInput</actualResult>
133+
</assertEquals>
111134
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '2')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillNewProductDefaultQty1"/>
112135
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '3')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillNewProductDefaultQty2"/>
113136

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ define([
1717
}
1818
},
1919

20+
/**
21+
* @inheritdoc
22+
*/
23+
setInitialValue: function () {
24+
this.initialValue = this.getInitialValue();
25+
26+
if (this.initialValue === undefined || this.initialValue === '') {
27+
this.initialValue = 1;
28+
}
29+
30+
if (this.value.peek() !== this.initialValue) {
31+
this.value(this.initialValue);
32+
}
33+
34+
this.on('value', this.onUpdate.bind(this));
35+
this.isUseDefault(this.disabled());
36+
37+
return this;
38+
},
39+
2040
/**
2141
* @inheritdoc
2242
*/
@@ -33,6 +53,5 @@ define([
3353

3454
return !this.visible() ? false : notEqual;
3555
}
36-
3756
});
3857
});

app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212

1313
namespace Magento\Catalog\Block\Product\View\Options;
1414

15-
use Magento\Catalog\Pricing\Price\BasePrice;
1615
use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule;
1716
use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface;
1817
use Magento\Framework\App\ObjectManager;
18+
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
19+
use Magento\Framework\Pricing\PriceCurrencyInterface;
1920

2021
/**
2122
* Product options section abstract block.
@@ -55,24 +56,42 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template
5556
*/
5657
private $calculateCustomOptionCatalogRule;
5758

59+
/**
60+
* @var CalculatorInterface
61+
*/
62+
private $calculator;
63+
64+
/**
65+
* @var PriceCurrencyInterface
66+
*/
67+
private $priceCurrency;
68+
5869
/**
5970
* @param \Magento\Framework\View\Element\Template\Context $context
6071
* @param \Magento\Framework\Pricing\Helper\Data $pricingHelper
6172
* @param \Magento\Catalog\Helper\Data $catalogData
6273
* @param array $data
6374
* @param CalculateCustomOptionCatalogRule|null $calculateCustomOptionCatalogRule
75+
* @param CalculatorInterface|null $calculator
76+
* @param PriceCurrencyInterface|null $priceCurrency
6477
*/
6578
public function __construct(
6679
\Magento\Framework\View\Element\Template\Context $context,
6780
\Magento\Framework\Pricing\Helper\Data $pricingHelper,
6881
\Magento\Catalog\Helper\Data $catalogData,
6982
array $data = [],
70-
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null
83+
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null,
84+
CalculatorInterface $calculator = null,
85+
PriceCurrencyInterface $priceCurrency = null
7186
) {
7287
$this->pricingHelper = $pricingHelper;
7388
$this->_catalogHelper = $catalogData;
7489
$this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule
7590
?? ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class);
91+
$this->calculator = $calculator
92+
?? ObjectManager::getInstance()->get(CalculatorInterface::class);
93+
$this->priceCurrency = $priceCurrency
94+
?? ObjectManager::getInstance()->get(PriceCurrencyInterface::class);
7695
parent::__construct($context, $data);
7796
}
7897

@@ -188,7 +207,13 @@ protected function _formatPrice($value, $flag = true)
188207
}
189208

190209
$context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true];
191-
$optionAmount = $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
210+
$optionAmount = $isPercent
211+
? $this->calculator->getAmount(
212+
$this->priceCurrency->roundPrice($value['pricing_value']),
213+
$this->getProduct(),
214+
null,
215+
$context
216+
) : $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
192217
$priceStr .= $this->getLayout()->getBlock('product.price.render.default')->renderAmount(
193218
$optionAmount,
194219
$customOptionPrice,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="AssertStorefrontCustomOptionCheckboxByPriceActionGroup">
12+
<annotations>
13+
<description>Validates that the provided price for Custom Option Checkbox is present on the Storefront Product page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="optionTitle" type="string" defaultValue="{{ProductOptionCheckbox.title}}"/>
17+
<argument name="price" type="string" defaultValue="10"/>
18+
</arguments>
19+
20+
<seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptionsCheckbox(optionTitle, price)}}" stepKey="checkPriceProductOptionCheckbox"/>
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="AssertStorefrontProductPageGalleryChangingFullscreenImageByRibbonActionGroup">
11+
<annotations>
12+
<description>On the product page change main image by clicking on the images in the ribbon. Fullscreen</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="startImage" type="string" />
16+
<argument name="expectedImage" type="string" />
17+
</arguments>
18+
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImageFullscreen(startImage)}}" stepKey="seeStartFullscreenImage"/>
19+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeActiveImageInThumbnail"/>
20+
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(expectedImage)}}" stepKey="clickOnExpectedImage"/>
21+
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(expectedImage)}}" stepKey="seeExpectedImageAfterClick"/>
22+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(expectedImage)}}" stepKey="seeExpectedImageActiveInThumbnailAfterChange"/>
23+
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(startImage)}}" stepKey="clickOnStartImageInRibbon"/>
24+
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(startImage)}}" stepKey="seeStartImageAfterSecondChange"/>
25+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeStartImageActiveInThumbnailAfterSecondChange"/>
26+
</actionGroup>
27+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="AssertStorefrontProductPageGalleryChangingMainImageByRibbonActionGroup">
11+
<annotations>
12+
<description>Changing main image on product page media gallery by clicking on the images in the fotorama ribbon</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="startImage" type="string" />
16+
<argument name="expectedImage" type="string" />
17+
</arguments>
18+
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="waitActiveImageDefault"/>
19+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeActiveImageThumbnail"/>
20+
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(expectedImage)}}" stepKey="firstClickOnImageInRibbon"/>
21+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(expectedImage)}}" stepKey="seeExpectedImageSelectedInRibbon"/>
22+
<seeElement selector="{{StorefrontProductMediaSection.productImage(expectedImage)}}" stepKey="seeChangedImageAfterFirstClick"/>
23+
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(startImage)}}" stepKey="secondClickOnImageInRibbon"/>
24+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeStartImageSelectedInRibbonAfterSecondClick"/>
25+
<seeElement selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="seeChangedImageAfterSecondClick"/>
26+
</actionGroup>
27+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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="AssertStorefrontProductPageGalleryFullscreenThumbnailDragActionGroup">
12+
<annotations>
13+
<description>On the product page check functional of drag actions in the fotorama ribbon during fullscreen</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="dragPointImage" type="string" />
17+
<argument name="currentImage" type="string"/>
18+
<argument name="firstImage" type="string" />
19+
</arguments>
20+
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImageFullscreen(currentImage)}}" stepKey="seeFullscreenImage"/>
21+
<seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="seeFirstImageInRibbon"/>
22+
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="-300" y="0" stepKey="dragRibbon"/>
23+
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(currentImage)}}" stepKey="seeFullscreenImageAfterDrag"/>
24+
<dontSeeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="dontSeeFirstImageInRibbonAfterDrag"/>
25+
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="300" y="0" stepKey="dragBackRibbon"/>
26+
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(currentImage)}}" stepKey="seeMainImageAfterBackDrag"/>
27+
<seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="seeFirstImageInRibbonAfterBackDrag"/>
28+
</actionGroup>
29+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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="AssertStorefrontProductPageGalleryImageDimensionsActionGroup">
11+
<annotations>
12+
<description>On the product page grab dimensions of the displayed product image, and image section. Assert that image is less or equals</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="imageSource" defaultValue="{{StorefrontProductMediaSection.mainImageForJsActions}}" type="string"/>
16+
</arguments>
17+
<executeJS function="var img=document.querySelector('{{imageSource}}');
18+
return img.clientHeight;" stepKey="getImageHeight"/>
19+
<executeJS function="var img=document.querySelector('{{imageSource}}');
20+
return img.clientWidth;" stepKey="getImageWidth"/>
21+
<executeJS function="var img=document.querySelector('{{StorefrontProductMediaSection.imageSectionForJsActions}}');
22+
return img.clientHeight;" stepKey="getSectionHeight"/>
23+
<executeJS function="var img=document.querySelector('{{StorefrontProductMediaSection.imageSectionForJsActions}}');
24+
return img.clientWidth;" stepKey="getSectionWidth"/>
25+
<assertLessThanOrEqual stepKey="checkHeightIsCorrect">
26+
<actualResult type="variable">getImageHeight</actualResult>
27+
<expectedResult type="variable">getSectionHeight</expectedResult>
28+
</assertLessThanOrEqual>
29+
<assertLessThanOrEqual stepKey="checkWidthIsCorrect">
30+
<actualResult type="variable">getImageWidth</actualResult>
31+
<expectedResult type="variable">getSectionWidth</expectedResult>
32+
</assertLessThanOrEqual>
33+
</actionGroup>
34+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="AssertStorefrontProductPageGalleryImagePositionInThumbnailRibbonActionGroup">
11+
<annotations>
12+
<description>Check the expected image position in the fotorama ribbon on the product page</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="image" defaultValue="Magento2.filename" type="string"/>
16+
<argument name="extension" defaultValue="Magento2.file_extension" type="string"/>
17+
<argument name="position" defaultValue="0" type="string" />
18+
</arguments>
19+
<grabAttributeFrom userInput="src" selector="{{StorefrontProductMediaSection.fotoramaImageThumbnailImgByNumber(position)}}" stepKey="grabSrcFromThumbnailImageByPosition"/>
20+
<assertRegExp stepKey="checkImagePositionInThumbnail">
21+
<actualResult type="variable">$grabSrcFromThumbnailImageByPosition</actualResult>
22+
<expectedResult type="string">|{{image}}[_\d]*.{{extension}}|</expectedResult>
23+
</assertRegExp>
24+
</actionGroup>
25+
</actionGroups>

0 commit comments

Comments
 (0)