Skip to content

Commit 09e5558

Browse files
committed
Merge branch '2.4-develop' into ACP2E-2622
2 parents 4c0e733 + 594a590 commit 09e5558

File tree

198 files changed

+5608
-1855
lines changed

Some content is hidden

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

198 files changed

+5608
-1855
lines changed

app/code/Magento/AwsS3/Test/Mftf/Helper/MockTestLogger.php

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,107 @@
1414
*
1515
* Ignores most log messages but throws errors on error/critical/emergency logs so tests will fail
1616
*/
17-
class MockTestLogger implements LoggerInterface {
18-
19-
public function emergency($message, array $context = array())
17+
class MockTestLogger implements LoggerInterface
18+
{
19+
/**
20+
* @param $message
21+
* @param array $context
22+
* @return void
23+
* @throws \Exception
24+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
25+
*/
26+
public function emergency($message, array $context = []): void
2027
{
2128
throw new \Exception($message);
2229
}
2330

24-
public function alert($message, array $context = array())
31+
/**
32+
* @param $message
33+
* @param array $context
34+
* @return void
35+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
36+
*/
37+
public function alert($message, array $context = []): void
2538
{
2639
// noop
2740
}
2841

29-
public function critical($message, array $context = array())
42+
/**
43+
* @param $message
44+
* @param array $context
45+
* @return void
46+
* @throws \Exception
47+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
48+
*/
49+
public function critical($message, array $context = []): void
3050
{
3151
throw new \Exception($message);
3252
}
3353

34-
public function error($message, array $context = array())
54+
/**
55+
* @param $message
56+
* @param array $context
57+
* @return void
58+
* @throws \Exception
59+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
60+
*/
61+
public function error($message, array $context = []): void
3562
{
3663
throw new \Exception($message);
3764
}
3865

39-
public function warning($message, array $context = array())
66+
/**
67+
* @param $message
68+
* @param array $context
69+
* @return void
70+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
71+
*/
72+
public function warning($message, array $context = []): void
4073
{
4174
// noop
4275
}
4376

44-
public function notice($message, array $context = array())
77+
/**
78+
* @param $message
79+
* @param array $context
80+
* @return void
81+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
82+
*/
83+
public function notice($message, array $context = []): void
4584
{
4685
// noop
4786
}
4887

49-
public function info($message, array $context = array())
88+
/**
89+
* @param $message
90+
* @param array $context
91+
* @return void
92+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
93+
*/
94+
public function info($message, array $context = []): void
5095
{
5196
// noop
5297
}
5398

54-
public function debug($message, array $context = array())
99+
/**
100+
* @param $message
101+
* @param array $context
102+
* @return void
103+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
104+
*/
105+
public function debug($message, array $context = []): void
55106
{
56107
// noop
57108
}
58109

59-
public function log($level, $message, array $context = array())
110+
/**
111+
* @param $level
112+
* @param $message
113+
* @param array $context
114+
* @return void
115+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
116+
*/
117+
public function log($level, $message, array $context = []): void
60118
{
61119
// noop
62120
}

app/code/Magento/Captcha/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"magento/module-store": "*",
1515
"magento/module-authorization": "*",
1616
"laminas/laminas-captcha": "^2.12",
17-
"laminas/laminas-db": "^2.13.4"
17+
"laminas/laminas-db": "^2.19"
1818
},
1919
"type": "magento2-module",
2020
"license": [

app/code/Magento/Catalog/Plugin/Block/Topmenu.php

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
use Magento\Framework\Data\Tree\Node;
1313

1414
/**
15-
* Plugin for top menu block
15+
* Plugin that enhances the top menu block by building and managing the category tree
16+
* for menu rendering in a storefront.
1617
*/
1718
class Topmenu
1819
{
1920
/**
20-
* Catalog category
21-
*
2221
* @var \Magento\Catalog\Helper\Category
2322
*/
2423
protected $catalogCategory;
@@ -33,29 +32,21 @@ class Topmenu
3332
*/
3433
private $storeManager;
3534

36-
/**
37-
* @var \Magento\Catalog\Model\Layer\Resolver
38-
*/
39-
private $layerResolver;
40-
4135
/**
4236
* Initialize dependencies.
4337
*
4438
* @param \Magento\Catalog\Helper\Category $catalogCategory
4539
* @param \Magento\Catalog\Model\ResourceModel\Category\StateDependentCollectionFactory $categoryCollectionFactory
4640
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
47-
* @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
4841
*/
4942
public function __construct(
5043
\Magento\Catalog\Helper\Category $catalogCategory,
5144
\Magento\Catalog\Model\ResourceModel\Category\StateDependentCollectionFactory $categoryCollectionFactory,
52-
\Magento\Store\Model\StoreManagerInterface $storeManager,
53-
\Magento\Catalog\Model\Layer\Resolver $layerResolver
45+
\Magento\Store\Model\StoreManagerInterface $storeManager
5446
) {
5547
$this->catalogCategory = $catalogCategory;
5648
$this->collectionFactory = $categoryCollectionFactory;
5749
$this->storeManager = $storeManager;
58-
$this->layerResolver = $layerResolver;
5950
}
6051

6152
/**
@@ -78,7 +69,6 @@ public function beforeGetHtml(
7869
$storeId = $this->storeManager->getStore()->getId();
7970
/** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
8071
$collection = $this->getCategoryTree($storeId, $rootId);
81-
$currentCategory = $this->getCurrentCategory();
8272
$mapping = [$rootId => $subject->getMenu()]; // use nodes stack to avoid recursion
8373
foreach ($collection as $category) {
8474
$categoryParentId = $category->getParentId();
@@ -97,7 +87,6 @@ public function beforeGetHtml(
9787
$categoryNode = new Node(
9888
$this->getCategoryAsArray(
9989
$category,
100-
$currentCategory,
10190
$category->getParentId() == $categoryParentId
10291
),
10392
'id',
@@ -132,39 +121,20 @@ public function beforeGetIdentities(\Magento\Theme\Block\Html\Topmenu $subject)
132121
}
133122
}
134123

135-
/**
136-
* Get current Category from catalog layer
137-
*
138-
* @return \Magento\Catalog\Model\Category
139-
*/
140-
private function getCurrentCategory()
141-
{
142-
$catalogLayer = $this->layerResolver->get();
143-
144-
if (!$catalogLayer) {
145-
return null;
146-
}
147-
148-
return $catalogLayer->getCurrentCategory();
149-
}
150-
151124
/**
152125
* Convert category to array
153126
*
154-
* @param \Magento\Catalog\Model\Category $category
155-
* @param \Magento\Catalog\Model\Category $currentCategory
127+
* @param Category $category
156128
* @param bool $isParentActive
157129
* @return array
158130
*/
159-
private function getCategoryAsArray($category, $currentCategory, $isParentActive)
131+
private function getCategoryAsArray($category, $isParentActive): array
160132
{
161133
$categoryId = $category->getId();
162134
return [
163135
'name' => $category->getName(),
164136
'id' => 'category-node-' . $categoryId,
165137
'url' => $this->catalogCategory->getCategoryUrl($category),
166-
'has_active' => in_array((string)$categoryId, explode('/', (string)$currentCategory->getPath()), true),
167-
'is_active' => $categoryId == $currentCategory->getId(),
168138
'is_category' => true,
169139
'is_parent_active' => $isParentActive
170140
];
@@ -196,22 +166,4 @@ protected function getCategoryTree($storeId, $rootId)
196166

197167
return $collection;
198168
}
199-
200-
/**
201-
* Add active
202-
*
203-
* @param \Magento\Theme\Block\Html\Topmenu $subject
204-
* @param string[] $result
205-
* @return string[]
206-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
207-
*/
208-
public function afterGetCacheKeyInfo(\Magento\Theme\Block\Html\Topmenu $subject, array $result)
209-
{
210-
$activeCategory = $this->getCurrentCategory();
211-
if ($activeCategory) {
212-
$result[] = Category::CACHE_TAG . '_' . $activeCategory->getId();
213-
}
214-
215-
return $result;
216-
}
217169
}

app/code/Magento/Catalog/Test/Fixture/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Product implements RevertibleDataFixtureInterface
5353
'media_gallery_entries' => [],
5454
'tier_prices' => [],
5555
'created_at' => null,
56-
'updated_at' => null,
56+
'updated_at' => null
5757
];
5858

5959
private const DEFAULT_PRODUCT_LINK_DATA = [

app/code/Magento/Catalog/Test/Fixture/ProductStock.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class ProductStock implements DataFixtureInterface
2626
{
2727
private const DEFAULT_DATA = [
2828
'prod_id' => null,
29-
'prod_qty' => 1
29+
'prod_qty' => 1,
30+
'is_in_stock' => 1
3031
];
3132

3233
/**
@@ -67,8 +68,8 @@ public function apply(array $data = []): ?DataObject
6768
{
6869
$data = $this->dataMerger->merge(self::DEFAULT_DATA, $data);
6970
$stockItem = $this->stockRegistry->getStockItem($data['prod_id']);
70-
$stockItem->setData('is_in_stock', 1);
71-
$stockItem->setData('qty', 90);
71+
$stockItem->setData('is_in_stock', $data['is_in_stock']);
72+
$stockItem->setData('qty', $data['prod_qty']);
7273
$stockItem->setData('manage_stock', 1);
7374
$stockItem->save();
7475

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<checkOption selector="{{AdminProductAttributeSetGridSection.selectFromAttributeResult(attributeCode)}}" stepKey="selectAttributeFromDisplayedResult"/>
2626
<click selector="{{AdminProductAttributeSetGridSection.addSelected}}" stepKey="clickAddSelectedButton" />
2727
<waitForPageLoad stepKey="waitForAttributesToBeAdded"/>
28-
<scrollTo selector="{{AdminProductFormSection.attributeTab}}" stepKey="scrollToAttributeTab" />
28+
<scrollTo selector="{{AdminProductFormSection.attributeTab}}" x="0" y="-100" stepKey="scrollToAttributeTab" />
2929
<click selector="{{AdminProductFormSection.attributeTab}}" stepKey="expandAttributeTab" />
3030
<selectOption selector="{{AdminProductFormSection.customSelectField(attributeCode)}}" userInput="{{adminOption1}}" stepKey="selectAvalueFromDropdown"/>
3131
<click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct" />
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="EnableCategoriesPathForProductUrls">
12+
<data key="path">catalog/seo/product_use_categories</data>
13+
<data key="scope_id">0</data>
14+
<data key="label">Yes</data>
15+
<data key="value">1</data>
16+
</entity>
17+
<entity name="DisableCategoriesPathForProductUrls">
18+
<data key="path">catalog/seo/product_use_categories</data>
19+
<data key="scope_id">0</data>
20+
<data key="label">No</data>
21+
<data key="value">0</data>
22+
</entity>
23+
</entities>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
<element name="collapseAll" type="button" selector=".tree-actions a:first-child"/>
1313
<element name="expandAll" type="button" selector=".tree-actions a:last-child"/>
1414
<element name="categoryHighlighted" type="text" selector="//div[@id='store.menu']//span[contains(text(),'{{name}}')]/ancestor::li" parameterized="true" timeout="30"/>
15+
<element name="dynamicActiveClassSelector" type="text" selector="//div[@id='store.menu']//span[contains(text(),'{{name}}')]/ancestor::li[contains(@class, '{{containsClass}}') and not(contains(@class, '{{notContainsClass}}'))]" parameterized="true" timeout="30"/>
1516
<element name="categoryNotHighlighted" type="text" selector="[id=\'store.menu\'] ul li.active" timeout="30"/>
17+
<element name="parentCategoryNotHighlighted" type="text" selector="[id=\'store.menu\'] ul li.has-active" timeout="30"/>
1618
<element name="categoryTreeRoot" type="text" selector="li.x-tree-node:first-of-type > div.x-tree-node-el:first-of-type" timeout="30"/>
1719
<element name="categoryInTree" type="text" selector="//a[contains(text(), '{{name}}')]" parameterized="true" timeout="30"/>
1820
<element name="categoryInFrontendTree" type="text" selector="//a/span[contains(text(), '{{name}}')]" parameterized="true" timeout="30"/>

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@
4747
<actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToAttributeEditPage">
4848
<argument name="ProductAttribute" value="Test Attribute"/>
4949
</actionGroup>
50-
<click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="clickDeleteAttribute" />
51-
<click selector="{{AttributeDeleteModalSection.confirm}}" stepKey="clickOkToConfirmDelete" />
52-
<waitForPageLoad stepKey="waitForDeletion"/>
50+
<actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"/>
51+
<comment userInput="BIC workaround" stepKey="clickDeleteAttribute"/>
52+
<comment userInput="BIC workaround" stepKey="clickOkToConfirmDelete"/>
53+
<comment userInput="BIC workaround" stepKey="waitForDeletion"/>
54+
55+
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
56+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexInvalidatedIndices">
57+
<argument name="indices" value=""/>
58+
</actionGroup>
5359

5460
<!-- Select the Default Category for Main Webstore -->
5561
<actionGroup ref="UpdateRootCategoryForStoresActionGroup" stepKey="UpdateRootCategoryForStores">

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@
2727
<actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage">
2828
<argument name="ProductAttribute" value="{{textSwatchProductAttribute.attribute_code}}"/>
2929
</actionGroup>
30-
<click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/>
31-
<click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/>
32-
<waitForPageLoad stepKey="waitForDeletion"/>
30+
31+
<actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"/>
32+
<comment userInput="BIC workaround" stepKey="clickDelete"/>
33+
<comment userInput="BIC workaround" stepKey="clickOk"/>
34+
<comment userInput="BIC workaround" stepKey="waitForDeletion"/>
35+
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
36+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexInvalidatedIndices">
37+
<argument name="indices" value=""/>
38+
</actionGroup>
39+
3340
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
3441
</after>
3542

0 commit comments

Comments
 (0)