Skip to content

Commit 04a4c7c

Browse files
merge magento-commerce/2.4-develop into magento-tsg/2.4-develop-pr113
2 parents 2504806 + b941603 commit 04a4c7c

File tree

47 files changed

+1896
-210
lines changed

Some content is hidden

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

47 files changed

+1896
-210
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminCheckNameToggleOnProductsMassAttributesUpdateActionGroup">
12+
<annotations>
13+
<description>Click the "Change" checkbox for the "Name" field on the Products Masss Attributes Update page.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminEditProductAttributesSection.ChangeAttributeNameToggle}}" stepKey="toggleToChangeName"/>
17+
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 22 additions & 0 deletions
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="AdminCheckProductOnProductGridActionGroup">
12+
<annotations>
13+
<description>Check the checkbox for the product on the Product Grid</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="product" type="entity"/>
17+
</arguments>
18+
19+
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/>
20+
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AdminClickSaveOnProductsMassAttributesUpdateActionGroup">
12+
<annotations>
13+
<description>Clicks on 'Save' button on products mass attributes update page.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminEditProductAttributesSection.Save}}" stepKey="save"/>
17+
<waitForPageLoad stepKey="waitForUpdateAttributesPage"/>
18+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Update Attributes" stepKey="seeUpdateAttributesTitle"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="AdminSetStockStatusActionGroup">
12+
<annotations>
13+
<description>Set Stock Status of product.</description>
14+
</annotations>
15+
16+
<arguments>
17+
<argument name="stockStatus" type="string" defaultValue="In Stock"/>
18+
</arguments>
19+
20+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{stockStatus}}" stepKey="setStockStatus"/>
21+
22+
</actionGroup>
23+
</actionGroups>

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
<scrollTo selector="{{AdminProductFormSection.productQuantity}}" stepKey="scrollToProductQuantity" after="waitForProductPageToLoad"/>
2222
<remove keyForRemoval="disableProduct"/>
23-
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="Out of Stock" stepKey="selectOutOfStock" after="scrollToProductQuantity"/>
23+
<actionGroup ref="AdminSetStockStatusActionGroup" stepKey="selectOutOfStock" after="scrollToProductQuantity">
24+
<argument name="stockStatus" value="Out of Stock"/>
25+
</actionGroup>
26+
2427
</test>
2528
</tests>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
<waitForPageLoad stepKey="waitForProductToLoad"/>
5454

5555
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQty"/>
56-
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="selectStockStatus"/>
56+
<actionGroup ref="AdminSetStockStatusActionGroup" stepKey="selectStockStatus">
57+
<argument name="stockStatus" value="In Stock"/>
58+
</actionGroup>
5759

5860
<!-- Create New Product Attribute -->
5961
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
<waitForPageLoad stepKey="waitForProductToLoad"/>
5151

5252
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQty"/>
53-
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="selectStockStatus"/>
53+
<actionGroup ref="AdminSetStockStatusActionGroup" stepKey="selectStockStatus">
54+
<argument name="stockStatus" value="In Stock"/>
55+
</actionGroup>
5456

5557
<!-- Create Product Attribute -->
5658
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/>

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,27 @@
3636
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
3737
</after>
3838

39-
<!-- Search and select products -->
4039
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
4140
<actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword">
4241
<argument name="keyword" value="api-simple-product"/>
4342
</actionGroup>
44-
<click selector="{{AdminProductGridSection.productGridCheckboxOnRow('1')}}" stepKey="clickCheckbox1"/>
45-
<click selector="{{AdminProductGridSection.productGridCheckboxOnRow('2')}}" stepKey="clickCheckbox2"/>
46-
<!-- Mass update attributes -->
47-
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickDropdown"/>
48-
<click selector="{{AdminProductGridSection.bulkActionOption('Update attributes')}}" stepKey="clickOption"/>
49-
<waitForPageLoad stepKey="waitForBulkUpdatePage"/>
50-
<seeInCurrentUrl stepKey="seeInUrl" url="catalog/product_action_attribute/edit/"/>
51-
<click selector="{{AdminEditProductAttributesSection.ChangeAttributeNameToggle}}" stepKey="toggleToChangeName"/>
52-
<click selector="{{AdminEditProductAttributesSection.Save}}" stepKey="save"/>
43+
44+
<actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="clickCheckbox1">
45+
<argument name="product" value="$$createProductOne$$"/>
46+
</actionGroup>
47+
48+
<actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="clickCheckbox2">
49+
<argument name="product" value="$$createProductTwo$$"/>
50+
</actionGroup>
51+
52+
<actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickDropdown"/>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOption"/>
54+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBulkUpdatePage"/>
55+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeInUrl"/>
56+
57+
<actionGroup ref="AdminCheckNameToggleOnProductsMassAttributesUpdateActionGroup" stepKey="toggleToChangeName"/>
58+
59+
<actionGroup ref="AdminClickSaveOnProductsMassAttributesUpdateActionGroup" stepKey="save"/>
5360
<see stepKey="seeError" selector="{{AdminEditProductAttributesSection.NameError}}" userInput="This is a required field"/>
5461
</test>
5562
</tests>

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ $blockId = $block->getId();
1010
<div id="product_composite_configure"
1111
class="product-configure-popup product-configure-popup-<?= $block->escapeHtmlAttr($blockId) ?>">
1212
<iframe name="product_composite_configure_iframe" id="product_composite_configure_iframe"></iframe>
13-
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
14-
'onload',
15-
"window.productConfigure && productConfigure.onLoadIFrame()",
16-
'iframe[name=\'product_composite_configure_iframe\']:last-of-type'
17-
) ?>
1813

1914
<form action="" method="post" id="product_composite_configure_form" enctype="multipart/form-data"
2015
target="product_composite_configure_iframe" class="product_composite_configure_form">
@@ -85,3 +80,8 @@ script;
8580
?>
8681
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false); ?>
8782
</div>
83+
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
84+
'onload',
85+
"window.productConfigure && productConfigure.onLoadIFrame()",
86+
'iframe[name=\'product_composite_configure_iframe\']:last-of-type'
87+
) ?>

app/code/Magento/CatalogUrlRewriteGraphQl/Model/Resolver/CategoryUrlSuffix.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function getCategoryUrlSuffix(int $storeId): ?string
7575
self::$xml_path_category_url_suffix,
7676
ScopeInterface::SCOPE_STORE,
7777
$storeId
78-
);
78+
) ?? '';
7979
}
8080
return $this->categoryUrlSuffix[$storeId];
8181
}

app/code/Magento/CatalogUrlRewriteGraphQl/Model/Resolver/ProductUrlSuffix.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function getProductUrlSuffix(int $storeId): ?string
7575
self::$xml_path_product_url_suffix,
7676
ScopeInterface::SCOPE_STORE,
7777
$storeId
78-
);
78+
) ?? '';
7979
}
8080
return $this->productUrlSuffix[$storeId];
8181
}
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\CatalogUrlRewriteGraphQl\Test\Unit\Model\Resolver;
8+
9+
use Magento\CatalogUrlRewriteGraphQl\Model\Resolver\CategoryUrlSuffix;
10+
use Magento\Framework\GraphQl\Config\Element\Field;
11+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
12+
use Magento\GraphQl\Model\Query\ContextExtensionInterface;
13+
use Magento\GraphQl\Model\Query\ContextInterface;
14+
use Magento\Store\Api\Data\StoreInterface;
15+
use PHPUnit\Framework\MockObject\MockObject;
16+
use PHPUnit\Framework\TestCase;
17+
use Magento\Framework\App\Config\ScopeConfigInterface;
18+
19+
/**
20+
* Test for \Magento\CatalogUrlRewriteGraphQl\Model\Resolver\CategoryUrlSuffix.
21+
*/
22+
class CategoryUrlSuffixTest extends TestCase
23+
{
24+
/**
25+
* @var ScopeConfigInterface|MockObject
26+
*/
27+
private $scopeConfigMock;
28+
29+
/**
30+
* @var ContextInterface|MockObject
31+
*/
32+
private $contextMock;
33+
34+
/**
35+
* @var ContextExtensionInterface|MockObject
36+
*/
37+
private $contextExtensionMock;
38+
39+
/**
40+
* @var StoreInterface|MockObject
41+
*/
42+
private $storeMock;
43+
44+
/**
45+
* @var Field|MockObject
46+
*/
47+
private $fieldMock;
48+
49+
/**
50+
* @var ResolveInfo|MockObject
51+
*/
52+
private $resolveInfoMock;
53+
54+
/**
55+
* @var CategoryUrlSuffix
56+
*/
57+
private $resolver;
58+
59+
/**
60+
* @inheritDoc
61+
*/
62+
protected function setUp(): void
63+
{
64+
$this->contextMock = $this->getMockBuilder(ContextInterface::class)
65+
->disableOriginalConstructor()
66+
->setMethods(
67+
[
68+
'getExtensionAttributes'
69+
]
70+
)
71+
->getMockForAbstractClass();
72+
73+
$this->contextExtensionMock = $this->getMockBuilder(ContextExtensionInterface::class)
74+
->setMethods(
75+
[
76+
'getStore'
77+
]
78+
)
79+
->getMockForAbstractClass();
80+
81+
$this->storeMock = $this->getMockBuilder(StoreInterface::class)
82+
->setMethods(
83+
[
84+
'getId'
85+
]
86+
)
87+
->getMockForAbstractClass();
88+
89+
$this->fieldMock = $this->getMockBuilder(Field::class)
90+
->disableOriginalConstructor()
91+
->getMock();
92+
93+
$this->resolveInfoMock = $this->getMockBuilder(ResolveInfo::class)
94+
->disableOriginalConstructor()
95+
->getMock();
96+
97+
$this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)
98+
->getMockForAbstractClass();
99+
100+
$this->resolver = new CategoryUrlSuffix(
101+
$this->scopeConfigMock
102+
);
103+
}
104+
105+
/**
106+
* Verify that empty string is returned when config value is null
107+
*/
108+
public function testNullValue()
109+
{
110+
$this->scopeConfigMock->expects($this->once())
111+
->method('getValue')
112+
->willReturn(null);
113+
114+
$this->contextMock
115+
->expects($this->once())
116+
->method('getExtensionAttributes')
117+
->willReturn($this->contextExtensionMock);
118+
119+
$this->contextExtensionMock
120+
->expects($this->once())
121+
->method('getStore')
122+
->willReturn($this->storeMock);
123+
124+
$this->storeMock
125+
->expects($this->once())
126+
->method('getId')
127+
->willReturn(1);
128+
129+
$this->assertEquals(
130+
'',
131+
$this->resolver->resolve(
132+
$this->fieldMock,
133+
$this->contextMock,
134+
$this->resolveInfoMock
135+
)
136+
);
137+
}
138+
139+
/**
140+
* Verify that the configured value is returned
141+
*/
142+
public function testNonNullValue()
143+
{
144+
$value = 'html';
145+
$this->scopeConfigMock->expects($this->once())
146+
->method('getValue')
147+
->willReturn($value);
148+
149+
$this->contextMock
150+
->expects($this->once())
151+
->method('getExtensionAttributes')
152+
->willReturn($this->contextExtensionMock);
153+
154+
$this->contextExtensionMock
155+
->expects($this->once())
156+
->method('getStore')
157+
->willReturn($this->storeMock);
158+
159+
$this->storeMock
160+
->expects($this->once())
161+
->method('getId')
162+
->willReturn(1);
163+
164+
$this->assertEquals(
165+
$value,
166+
$this->resolver->resolve(
167+
$this->fieldMock,
168+
$this->contextMock,
169+
$this->resolveInfoMock
170+
)
171+
);
172+
}
173+
}

0 commit comments

Comments
 (0)