Skip to content

Commit cff1746

Browse files
merge magento/2.4-develop into magento-tsg/2.4-develop-com-pr12
2 parents f440c1c + 63a6786 commit cff1746

File tree

42 files changed

+1597
-345
lines changed

Some content is hidden

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

42 files changed

+1597
-345
lines changed

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,6 @@
7979
<requiredEntity createDataKey="createBundleOptionWithAttribute"/>
8080
<requiredEntity createDataKey="secondSimpleProductForFixedWithAttribute"/>
8181
</createData>
82-
83-
<!-- Start message queue for export consumer -->
84-
<actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueue">
85-
<argument name="consumerName" value="{{AdminExportMessageConsumerData.consumerName}}"/>
86-
<argument name="maxMessages" value="{{AdminExportMessageConsumerData.messageLimit}}"/>
87-
</actionGroup>
88-
<reloadPage stepKey="refreshPage"/>
89-
<waitForPageLoad stepKey="waitForPageLoaded"/>
9082
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
9183
</before>
9284
<after>
@@ -100,9 +92,8 @@
10092
<deleteData createDataKey="firstSimpleProductForFixedWithAttribute" stepKey="deleteFirstSimpleProductForFixedWithAttribute"/>
10193
<deleteData createDataKey="secondSimpleProductForFixedWithAttribute" stepKey="deleteSecondSimpleProductForFixedWithAttribute"/>
10294
<deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/>
103-
95+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
10496
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
105-
<magentoCLI command="cron:run --group=index" stepKey="reindexInvalidatedIndices"/>
10697
</after>
10798

10899
<!-- Go to export page -->
@@ -111,7 +102,12 @@
111102
<!-- Export created below products -->
112103
<actionGroup ref="ExportAllProductsActionGroup" stepKey="exportCreatedProducts"/>
113104

114-
<magentoCron stepKey="runCronIndex" groups="index"/>
105+
<!-- Start message queue for export consumer -->
106+
<actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueue">
107+
<argument name="consumerName" value="{{AdminExportMessageConsumerData.consumerName}}"/>
108+
<argument name="maxMessages" value="{{AdminExportMessageConsumerData.messageLimit}}"/>
109+
</actionGroup>
110+
<reloadPage stepKey="refreshPage"/>
115111
<waitForElementVisible selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="waitForFileName"/>
116112
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
117113

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
5656
<deleteData createDataKey="createGroupedProduct" stepKey="deleteGroupedProduct"/>
5757
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
58-
58+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
5959
<!-- Log out -->
6060
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
6161
</after>
@@ -73,8 +73,7 @@
7373
<argument name="maxMessages" value="{{AdminExportMessageConsumerData.messageLimit}}"/>
7474
</actionGroup>
7575
<reloadPage stepKey="refreshPage"/>
76-
<waitForPageLoad stepKey="waitForPageLoaded"/>
77-
76+
<waitForElementVisible selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="waitForFileName"/>
7877
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
7978

8079
<!-- Download product -->

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@
150150
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
151151
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
152152
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/>
153+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
153154
<!-- Admin logout-->
154155
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
155-
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
156156
</after>
157157

158158
<!-- Go to System > Export -->
@@ -170,8 +170,7 @@
170170
<argument name="maxMessages" value="{{AdminExportMessageConsumerData.messageLimit}}"/>
171171
</actionGroup>
172172
<reloadPage stepKey="refreshPage"/>
173-
<waitForPageLoad stepKey="waitForPageLoaded"/>
174-
173+
<waitForElementVisible selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="waitForFileName"/>
175174
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
176175

177176
<!-- Save exported file: file successfully downloaded -->

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@
8383
<deleteData createDataKey="createConfigSecondChildProduct" stepKey="deleteConfigSecondChildProduct"/>
8484
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
8585
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
86-
87-
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
8886
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
87+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
8988
</after>
9089

9190
<!-- Go to export page -->
@@ -104,8 +103,7 @@
104103
<argument name="maxMessages" value="{{AdminExportMessageConsumerData.messageLimit}}"/>
105104
</actionGroup>
106105
<reloadPage stepKey="refreshPage"/>
107-
<waitForPageLoad stepKey="waitForPageLoaded"/>
108-
106+
<waitForElementVisible selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="waitForFileName"/>
109107
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
110108

111109
<!-- Download product -->

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@
9999
<deleteData createDataKey="createConfigSecondChildProduct" stepKey="deleteConfigSecondChildProduct"/>
100100
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
101101
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
102-
103-
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
104102
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
103+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
105104
</after>
106105

107106
<!-- Go to export page -->
@@ -119,8 +118,7 @@
119118
<argument name="maxMessages" value="{{AdminExportMessageConsumerData.messageLimit}}"/>
120119
</actionGroup>
121120
<reloadPage stepKey="refreshPage"/>
122-
<waitForPageLoad stepKey="waitForPageLoaded"/>
123-
121+
<waitForElementVisible selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="waitForFileName"/>
124122
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
125123

126124
<!-- Download product -->

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@
8585
<deleteData createDataKey="createConfigSecondChildProduct" stepKey="deleteConfigSecondChildProduct"/>
8686
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
8787
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
88-
89-
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
9088
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
89+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
9190
</after>
9291

9392
<!-- Go to export page -->
@@ -103,8 +102,7 @@
103102
<argument name="maxMessages" value="{{AdminExportMessageConsumerData.messageLimit}}"/>
104103
</actionGroup>
105104
<reloadPage stepKey="refreshPage"/>
106-
<waitForPageLoad stepKey="waitForPageLoaded"/>
107-
105+
<waitForElementVisible selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="waitForFileName"/>
108106
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
109107

110108
<!-- Download product -->

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<deleteData createDataKey="createSimpleProductWithCustomAttributeSet" stepKey="deleteSimpleProductWithCustomAttributeSet"/>
3838
<deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/>
3939
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
40-
40+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
4141
<!-- Log out -->
4242
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4343
</after>
@@ -55,7 +55,7 @@
5555
<argument name="maxMessages" value="{{AdminExportMessageConsumerData.messageLimit}}"/>
5656
</actionGroup>
5757
<reloadPage stepKey="pageReload" />
58-
<waitForPageLoad stepKey="waitForPageLoaded" />
58+
<waitForElementVisible selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="waitForFileName"/>
5959
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
6060

6161
<!-- Download product -->

app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest/AdminCreateCatalogPriceRuleForCustomerGroupTest.xml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<testCaseId value="MC-71"/>
1818
<group value="CatalogRule"/>
1919
</annotations>
20+
2021
<before>
2122
<!-- Create a simple product and a category-->
2223
<createData entity="ApiCategory" stepKey="createCategory"/>
@@ -25,33 +26,32 @@
2526
</createData>
2627

2728
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
29+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/>
30+
<!-- Perform reindex and flush cache -->
31+
<actionGroup ref="AdminReindexAndFlushCache" stepKey="reindexAndFlushCache"/>
2832
</before>
33+
2934
<after>
3035
<!-- Delete the simple product and category -->
3136
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
3237
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
33-
<!-- Delete the catalog rule -->
34-
<amOnPage url="{{CatalogRulePage.url}}" stepKey="goToRulePage"/>
35-
<waitForPageLoad stepKey="waitForRulePage"/>
36-
<actionGroup ref="deleteEntitySecondaryGrid" stepKey="deletePriceRule">
37-
<argument name="name" value="{{_defaultCatalogRule.name}}"/>
38-
<argument name="searchInput" value="{{AdminSecondaryGridSection.catalogRuleIdentifierSearch}}"/>
39-
</actionGroup>
40-
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
38+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/>
39+
<actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/>
40+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
4141
</after>
4242

4343
<!-- Create a catalog rule for the NOT LOGGED IN customer group -->
44-
<actionGroup ref="NewCatalogPriceRuleByUIActionGroup" stepKey="createNewPriceRule"/>
45-
<actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/>
46-
<click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="saveAndApply"/>
47-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule." stepKey="assertSuccess"/>
48-
49-
<!-- Perform reindex and flush cache -->
50-
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
51-
<magentoCLI command="cache:flush" stepKey="flushCache"/>
44+
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="createNewPriceRule"/>
45+
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForPriceRule">
46+
<argument name="groups" value="'NOT LOGGED IN'"/>
47+
</actionGroup>
48+
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsPriceRule"/>
49+
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyFPriceRule"/>
5250

5351
<!-- As a NOT LOGGED IN user, go to the storefront category page and should see the discount -->
54-
<amOnPage url="$$createCategory.name$$.html" stepKey="goToCategory1"/>
52+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToCategory1">
53+
<argument name="category" value="$createCategory$"/>
54+
</actionGroup>
5555
<see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="$$createProduct.name$$" stepKey="seeProduct1"/>
5656
<see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="$110.70" stepKey="seeDiscountedPrice1"/>
5757

@@ -67,7 +67,9 @@
6767
</actionGroup>
6868

6969
<!-- As a logged in user, go to the storefront category page and should NOT see discount -->
70-
<amOnPage url="$$createCategory.name$$.html" stepKey="goToCategory2"/>
70+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToCategory2">
71+
<argument name="category" value="$createCategory$"/>
72+
</actionGroup>
7173
<see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="$$createProduct.name$$" stepKey="seeProduct2"/>
7274
<see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="$123.00" stepKey="seeDiscountedPrice2"/>
7375
</test>

app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
*
2020
* @see \Magento\Store\Model\ResourceModel\Store
2121
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
22-
* @package Magento\CatalogUrlRewrite\Model\Category\Plugin\Store
2322
*/
2423
class View
2524
{
@@ -39,7 +38,7 @@ class View
3938
protected $productFactory;
4039

4140
/**
42-
* @var \Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator
41+
* @var CategoryUrlRewriteGenerator
4342
*/
4443
protected $categoryUrlRewriteGenerator;
4544

@@ -75,6 +74,8 @@ public function __construct(
7574
}
7675

7776
/**
77+
* Setter for Orig Store data
78+
*
7879
* @param \Magento\Store\Model\ResourceModel\Store $object
7980
* @param AbstractModel $store
8081
* @return void
@@ -100,14 +101,13 @@ public function afterSave(
100101
\Magento\Store\Model\ResourceModel\Store $store
101102
) {
102103
if ($this->origStore->isObjectNew() || $this->origStore->dataHasChangedFor('group_id')) {
103-
if (!$this->origStore->isObjectNew()) {
104-
$this->urlPersist->deleteByData([UrlRewrite::STORE_ID => $this->origStore->getId()]);
105-
}
106-
107-
$this->urlPersist->replace(
108-
$this->generateCategoryUrls($this->origStore->getRootCategoryId(), $this->origStore->getId())
104+
$categoryRewriteUrls = $this->generateCategoryUrls(
105+
$this->origStore->getRootCategoryId(),
106+
$this->origStore->getId()
109107
);
110108

109+
$this->urlPersist->replace($categoryRewriteUrls);
110+
111111
$this->urlPersist->replace(
112112
$this->generateProductUrls(
113113
$this->origStore->getWebsiteId(),
@@ -139,33 +139,34 @@ protected function generateProductUrls($websiteId, $originWebsiteId, $storeId)
139139
->addAttributeToSelect(['name', 'url_path', 'url_key', 'visibility'])
140140
->addWebsiteFilter($websiteIds);
141141
foreach ($collection as $product) {
142-
$product->setStoreId($storeId);
143142
/** @var \Magento\Catalog\Model\Product $product */
144-
$urls = array_merge(
145-
$urls,
146-
$this->productUrlRewriteGenerator->generate($product)
147-
);
143+
$product->setStoreId($storeId);
144+
$urls[] = $this->productUrlRewriteGenerator->generate($product);
148145
}
146+
$urls = array_merge([], ...$urls);
147+
149148
return $urls;
150149
}
151150

152151
/**
152+
* Generate url rewrites for categories
153+
*
153154
* @param int $rootCategoryId
154155
* @param int $storeId
155156
* @return array
156157
*/
157158
protected function generateCategoryUrls($rootCategoryId, $storeId)
158159
{
159160
$urls = [];
160-
$categories = $this->categoryFactory->create()->getCategories($rootCategoryId, 1, false, true);
161+
$categories = $this->categoryFactory->create()->getCategories($rootCategoryId, 1, false, true, false);
162+
$categories->setStoreId($storeId);
161163
foreach ($categories as $category) {
162-
/** @var \Magento\Catalog\Model\Category $category */
164+
/** @var Category $category */
163165
$category->setStoreId($storeId);
164-
$urls = array_merge(
165-
$urls,
166-
$this->categoryUrlRewriteGenerator->generate($category)
167-
);
166+
$urls[] = $this->categoryUrlRewriteGenerator->generate($category);
168167
}
168+
$urls = array_merge([], ...$urls);
169+
169170
return $urls;
170171
}
171172

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/ViewTest.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\CatalogUrlRewrite\Test\Unit\Model\Category\Plugin\Store;
99

10+
use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection;
1011
use Magento\Catalog\Model\Category;
1112
use Magento\Catalog\Model\CategoryFactory;
1213
use Magento\Catalog\Model\Product;
@@ -87,6 +88,9 @@ class ViewTest extends TestCase
8788
*/
8889
private $productMock;
8990

91+
/**
92+
* @inheritdoc
93+
*/
9094
protected function setUp(): void
9195
{
9296
$this->objectManager = new ObjectManager($this);
@@ -139,7 +143,12 @@ protected function setUp(): void
139143
);
140144
}
141145

142-
public function testAfterSave()
146+
/**
147+
* Test after save
148+
*
149+
* @return void
150+
*/
151+
public function testAfterSave(): void
143152
{
144153
$origStoreMock = $this->getMockBuilder(\Magento\Store\Model\Store::class)
145154
->disableOriginalConstructor()
@@ -155,9 +164,16 @@ public function testAfterSave()
155164
$this->abstractModelMock->expects($this->any())
156165
->method('isObjectNew')
157166
->willReturn(true);
167+
$categoryCollection = $this->getMockBuilder(CategoryCollection::class)
168+
->disableOriginalConstructor()
169+
->setMethods(['getIterator'])
170+
->getMock();
171+
$categoryCollection->expects($this->any())
172+
->method('getIterator')
173+
->willReturn(new \ArrayIterator([]));
158174
$this->categoryMock->expects($this->once())
159175
->method('getCategories')
160-
->willReturn([]);
176+
->willReturn($categoryCollection);
161177
$this->categoryFactoryMock->expects($this->once())
162178
->method('create')
163179
->willReturn($this->categoryMock);
@@ -191,7 +207,12 @@ public function testAfterSave()
191207
);
192208
}
193209

194-
public function testAfterDelete()
210+
/**
211+
* Test after delete
212+
*
213+
* @return void
214+
*/
215+
public function testAfterDelete(): void
195216
{
196217
$this->urlPersistMock->expects($this->once())
197218
->method('deleteByData');

0 commit comments

Comments
 (0)