Skip to content

Commit 7cedea5

Browse files
committed
Merge branch '2.4-develop' into ref-AdminValidateShippingTrackingNumberTes
2 parents 0406e76 + 960a51f commit 7cedea5

File tree

129 files changed

+4573
-411
lines changed

Some content is hidden

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

129 files changed

+4573
-411
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ indent_size = 2
1616

1717
[{composer, auth}.json]
1818
indent_size = 4
19+
20+
[db_schema_whitelist.json]
21+
indent_size = 4
22+
trim_trailing_whitespace = false

app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
* getPagerVisibility()
1515
* getVarNamePage()
1616
*/
17-
$numColumns = count($block->getColumns());
1817

1918
/**
2019
* @var \Magento\Backend\Block\Widget\Grid\Extended $block
2120
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
2221
*/
22+
$numColumns = count($block->getColumns());
23+
2324
?>
2425
<?php if ($block->getCollection()): ?>
2526
<?php if ($block->canDisplayContainer()): ?>
@@ -285,7 +286,9 @@ $numColumns = count($block->getColumns());
285286
</table>
286287

287288
</div>
289+
<?php if ($block->canDisplayContainer()): ?>
288290
</div>
291+
<?php endif; ?>
289292
<?php
290293
/** @var \Magento\Framework\Json\Helper\Data $jsonHelper */
291294
$jsonHelper = $block->getData('jsonHelper');

app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ public function create(
5252
$quantity,
5353
array $arguments = []
5454
) {
55+
$quantity = $quantity ? (float)$quantity : 1.;
56+
$selection->setQty($quantity);
57+
5558
$arguments['bundleProduct'] = $bundleProduct;
5659
$arguments['saleableItem'] = $selection;
57-
$arguments['quantity'] = $quantity ? (float)$quantity : 1.;
60+
$arguments['quantity'] = $quantity;
5861

5962
return $this->objectManager->create(self::SELECTION_CLASS_DEFAULT, $arguments);
6063
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="cartClickCategory"/>
7171

7272
<!--Click add to cart-->
73-
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/>
73+
<actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverProduct"/>
7474
<actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addProductToCart"/>
7575

7676
<!--Check for details page-->
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Bundle\Test\Unit\Ui\DataProvider\Product\Form\Modifier;
9+
10+
use Magento\Bundle\Model\Product\Attribute\Source\Shipment\Type as ShipmentType;
11+
use Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundlePanel;
12+
use Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundlePrice;
13+
use Magento\Catalog\Api\Data\ProductInterface;
14+
use Magento\Catalog\Model\Locator\LocatorInterface;
15+
use Magento\Framework\Stdlib\ArrayManager;
16+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
17+
use Magento\Framework\UrlInterface;
18+
use PHPUnit\Framework\MockObject\MockObject;
19+
use PHPUnit\Framework\TestCase;
20+
21+
/**
22+
* Test for bundle panel
23+
*/
24+
class BundlePanelTest extends TestCase
25+
{
26+
/**
27+
* @var UrlInterface|MockObject
28+
*/
29+
private $urlBuilder;
30+
31+
/**
32+
* @var ShipmentType|MockObject
33+
*/
34+
private $shipmentType;
35+
36+
/**
37+
* @var LocatorInterface|MockObject
38+
*/
39+
private $locatorMock;
40+
41+
/**
42+
* @var ProductInterface|MockObject
43+
*/
44+
private $productMock;
45+
46+
/**
47+
* @var ArrayManager|MockObject
48+
*/
49+
private $arrayManagerMock;
50+
51+
/**
52+
* @var BundlePanel
53+
*/
54+
private $bundlePanelModel;
55+
56+
/**
57+
* @return void
58+
*/
59+
protected function setUp(): void
60+
{
61+
$this->objectManager = new ObjectManager($this);
62+
$this->arrayManagerMock = $this->getMockBuilder(ArrayManager::class)
63+
->disableOriginalConstructor()
64+
->getMock();
65+
$this->arrayManagerMock->expects($this->any())
66+
->method('get')
67+
->willReturn([]);
68+
$this->urlBuilder = $this->getMockBuilder(UrlInterface::class)
69+
->getMockForAbstractClass();
70+
$this->shipmentType = $this->getMockBuilder(ShipmentType::class)
71+
->getMockForAbstractClass();
72+
$this->productMock = $this->getMockBuilder(ProductInterface::class)
73+
->addMethods(['getStoreId'])
74+
->getMockForAbstractClass();
75+
$this->productMock->method('getId')
76+
->willReturn(true);
77+
$this->productMock->method('getStoreId')
78+
->willReturn(0);
79+
$this->locatorMock = $this->getMockBuilder(LocatorInterface::class)
80+
->onlyMethods(['getProduct'])
81+
->getMockForAbstractClass();
82+
$this->locatorMock->method('getProduct')
83+
->willReturn($this->productMock);
84+
85+
$this->bundlePanelModel = $this->objectManager->getObject(
86+
BundlePanel::class,
87+
[
88+
'locator' => $this->locatorMock,
89+
'urlBuilder' => $this->urlBuilder,
90+
'shipmentType' => $this->shipmentType,
91+
'arrayManager' => $this->arrayManagerMock,
92+
]
93+
);
94+
}
95+
96+
/**
97+
* Test for modify meta
98+
*
99+
* @param string $shipmentTypePath
100+
* @param string $dataScope
101+
*
102+
* @return void
103+
* @dataProvider getDataModifyMeta
104+
*/
105+
public function testModifyMeta(string $shipmentTypePath, string $dataScope): void
106+
{
107+
$sourceMeta = [
108+
'bundle-items' => [
109+
'children' => [
110+
BundlePrice::CODE_PRICE_TYPE => []
111+
]
112+
]
113+
];
114+
$this->arrayManagerMock->method('findPath')
115+
->willReturnMap(
116+
[
117+
[
118+
BundlePanel::CODE_SHIPMENT_TYPE,
119+
[],
120+
null,
121+
'children',
122+
ArrayManager::DEFAULT_PATH_DELIMITER,
123+
$shipmentTypePath
124+
],
125+
]
126+
);
127+
$this->arrayManagerMock->method('merge')
128+
->willReturn([]);
129+
$this->arrayManagerMock->method('remove')
130+
->willReturn([]);
131+
$this->arrayManagerMock->method('set')
132+
->willReturn([]);
133+
$this->arrayManagerMock->expects($this->at(12))
134+
->method('merge')
135+
->with(
136+
$shipmentTypePath . BundlePanel::META_CONFIG_PATH,
137+
[],
138+
[
139+
'dataScope' => $dataScope,
140+
'validation' => [
141+
'required-entry' => false
142+
]
143+
]
144+
);
145+
$this->bundlePanelModel->modifyMeta($sourceMeta);
146+
}
147+
148+
/**
149+
* Data provider for modify meta test
150+
*
151+
* @return string[][]
152+
*/
153+
public function getDataModifyMeta(): array
154+
{
155+
return [
156+
[
157+
'bundle-items/children',
158+
'data.product.shipment_type'
159+
],
160+
[
161+
'someAttrGroup/children',
162+
'shipment_type'
163+
],
164+
];
165+
}
166+
}

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,19 @@ public function modifyData(array $data)
252252
*/
253253
private function modifyShipmentType(array $meta)
254254
{
255+
$actualPath = $this->arrayManager->findPath(
256+
static::CODE_SHIPMENT_TYPE,
257+
$meta,
258+
null,
259+
'children'
260+
);
261+
255262
$meta = $this->arrayManager->merge(
256-
$this->arrayManager->findPath(
257-
static::CODE_SHIPMENT_TYPE,
258-
$meta,
259-
null,
260-
'children'
261-
) . static::META_CONFIG_PATH,
263+
$actualPath . static::META_CONFIG_PATH,
262264
$meta,
263265
[
264-
'dataScope' => 'data.product.shipment_type',
266+
'dataScope' => stripos($actualPath, self::CODE_BUNDLE_DATA) === 0
267+
? 'data.product.shipment_type' : 'shipment_type',
265268
'validation' => [
266269
'required-entry' => false
267270
]

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

Lines changed: 75 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -124,62 +124,108 @@
124124
</after>
125125

126126
<!-- Open Product in Store Front Page -->
127-
<amOnPage url="$$createConfigProduct.sku$$.html" stepKey="openProductInStoreFront"/>
128-
<waitForPageLoad stepKey="waitForProductToLoad"/>
127+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront">
128+
<argument name="product" value="$createConfigProduct$"/>
129+
</actionGroup>
130+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad"/>
129131

130132
<!-- Verify category,Configurable product and initial price -->
131-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage"/>
132-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront"/>
133-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct1.price$$" stepKey="seeInitialPriceInStoreFront"/>
133+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage">
134+
<argument name="categoryName" value="$$createCategory.name$$"/>
135+
</actionGroup>
136+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront">
137+
<argument name="productName" value="$$createConfigProduct.name$$"/>
138+
</actionGroup>
139+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeInitialPriceInStoreFront">
140+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
141+
</actionGroup>
134142
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront">
135143
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
136144
</actionGroup>
137-
<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStatusInStoreFront"/>
145+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront">
146+
<argument name="productStockStatus" value="In Stock"/>
147+
</actionGroup>
138148

139149
<!-- Verify First Child Product attribute option is displayed -->
140150
<see selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeOption1"/>
141151

142152
<!-- Select product Attribute option1, option2 and option3 and verify changes in the price -->
143-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="selectOption1"/>
144-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct1.price$$" stepKey="seeChildProduct1PriceInStoreFront"/>
145-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption2.label$$" stepKey="selectOption2"/>
146-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct2.price$$" stepKey="seeChildProduct2PriceInStoreFront"/>
147-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption3.label$$" stepKey="selectOption3"/>
148-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct3.price$$" stepKey="seeChildProduct3PriceInStoreFront"/>
149-
153+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption1">
154+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
155+
<argument name="optionLabel" value="$$getConfigAttributeOption1.label$$"/>
156+
</actionGroup>
157+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct1PriceInStoreFront">
158+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
159+
</actionGroup>
160+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption2">
161+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
162+
<argument name="optionLabel" value="$$getConfigAttributeOption2.label$$"/>
163+
</actionGroup>
164+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct2PriceInStoreFront">
165+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
166+
</actionGroup>
167+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption3">
168+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
169+
<argument name="optionLabel" value="$$getConfigAttributeOption3.label$$"/>
170+
</actionGroup>
171+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct3PriceInStoreFront">
172+
<argument name="productPrice" value="$$createConfigChildProduct3.price$$"/>
173+
</actionGroup>
150174
<!-- Open Product Index Page and Filter First Child product -->
151-
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
152-
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct">
153-
<argument name="product" value="ApiSimpleOne"/>
175+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="navigateToProductIndex"/>
176+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterProduct"/>
177+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="selectFirstRow">
178+
<argument name="productId" value="$$createConfigChildProduct1.id$$"/>
154179
</actionGroup>
155-
<click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="selectFirstRow"/>
156180
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
157181

158182
<!-- Disable the product -->
159-
<click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="disableProduct"/>
183+
<actionGroup ref="ToggleProductEnabledActionGroup" stepKey="disableProduct"/>
160184
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton"/>
161-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
185+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
186+
<argument name="message" value="You saved the product."/>
187+
</actionGroup>
162188

163189
<!-- Open Product Store Front Page -->
164-
<amOnPage url="$$createConfigProduct.sku$$.html" stepKey="openProductInStoreFront1"/>
165-
<waitForPageLoad stepKey="waitForProductToLoad1"/>
190+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront1">
191+
<argument name="product" value="$createConfigProduct$"/>
192+
</actionGroup>
193+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad1"/>
166194

167195
<!-- Verify category,configurable product and updated price -->
168-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage1"/>
169-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront1"/>
170-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct2.price$$" stepKey="seeUpdatedProductPriceInStoreFront"/>
196+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage1">
197+
<argument name="categoryName" value="$$createCategory.name$$"/>
198+
</actionGroup>
199+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront1">
200+
<argument name="productName" value="$$createConfigProduct.name$$"/>
201+
</actionGroup>
202+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeUpdatedProductPriceInStoreFront">
203+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
204+
</actionGroup>
171205
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront1">
172206
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
173207
</actionGroup>
174-
<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStatusInStoreFront1"/>
208+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront1">
209+
<argument name="productStockStatus" value="In Stock"/>
210+
</actionGroup>
175211

176212
<!-- Verify product Attribute Option1 is not displayed -->
177213
<dontSee selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="dontSeeOption1"/>
178214

179215
<!--Select product Attribute option2 and option3 and verify changes in the price -->
180-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption2.label$$" stepKey="selectTheOption2"/>
181-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct2.price$$" stepKey="seeSecondChildProductPriceInStoreFront"/>
182-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption3.label$$" stepKey="selectTheOption3"/>
183-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct3.price$$" stepKey="seeThirdProductPriceInStoreFront"/>
216+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectTheOption2">
217+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
218+
<argument name="optionLabel" value="$$getConfigAttributeOption2.label$$"/>
219+
</actionGroup>
220+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeSecondChildProductPriceInStoreFront">
221+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
222+
</actionGroup>
223+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectTheOption3">
224+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
225+
<argument name="optionLabel" value="$$getConfigAttributeOption3.label$$"/>
226+
</actionGroup>
227+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeThirdProductPriceInStoreFront">
228+
<argument name="productPrice" value="$$createConfigChildProduct3.price$$"/>
229+
</actionGroup>
184230
</test>
185231
</tests>

0 commit comments

Comments
 (0)