Skip to content

Commit 56de1b9

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into arrows_platform_health_02192025
2 parents f7181e6 + c699c20 commit 56de1b9

File tree

59 files changed

+1504
-2470
lines changed

Some content is hidden

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

59 files changed

+1504
-2470
lines changed

app/code/Magento/AdvancedSearch/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The Magento_AdvancedSearch module introduces advanced search functionality and p
77
Before disabling or uninstalling this module, note that the following modules depends on this module:
88

99
- Magento_Elasticsearch
10-
- Magento_Elasticsearch7
10+
- Magento_Elasticsearch8
1111

1212
For information about module installation in Magento 2, see [Enable or disable modules](https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/tutorials/manage-modules.html).
1313

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Catalog\Plugin\Model;
10+
11+
use Magento\Catalog\Api\Data\CategoryInterface;
12+
use Magento\Catalog\Model\CategoryRepository;
13+
14+
/**
15+
* Plugin for category repository
16+
*/
17+
class CategoryRepositoryPlugin
18+
{
19+
private const ATTRIBUTES_TO_PROCESS = [
20+
'url_key',
21+
'url_path'
22+
];
23+
24+
/**
25+
* Formats category url key and path using the default formatter.
26+
*
27+
* @param CategoryRepository $subject
28+
* @param CategoryInterface $category
29+
* @return array
30+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
31+
*/
32+
public function beforeSave(CategoryRepository $subject, CategoryInterface $category): array
33+
{
34+
foreach (self::ATTRIBUTES_TO_PROCESS as $attributeKey) {
35+
$attribute = $category->getCustomAttribute($attributeKey);
36+
if ($attribute !== null) {
37+
$value = $category->getData($attributeKey);
38+
$formattedValue = $category->formatUrlKey($value);
39+
$attribute->setValue($formattedValue);
40+
}
41+
}
42+
return [$category];
43+
}
44+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Test\Unit\Plugin\Model;
9+
10+
use Magento\Catalog\Plugin\Model\CategoryRepositoryPlugin;
11+
use Magento\Catalog\Model\CategoryRepository;
12+
use PHPUnit\Framework\TestCase;
13+
use PHPUnit\Framework\MockObject\MockObject;
14+
use Magento\Framework\Api\AttributeInterface;
15+
use Magento\Catalog\Model\Category;
16+
17+
class CategoryRepositoryPluginTest extends TestCase
18+
{
19+
/**
20+
* @var CategoryRepositoryPlugin
21+
*/
22+
private $categoryRepositoryPluginMock;
23+
24+
/**
25+
* @var CategoryRepository|MockObject
26+
*/
27+
private $categoryRepositoryMock;
28+
29+
/**
30+
* @var Category|MockObject
31+
*/
32+
private $categoryMock;
33+
34+
protected function setUp(): void
35+
{
36+
$this->categoryRepositoryMock = $this->createMock(CategoryRepository::class);
37+
$this->categoryMock = $this->createMock(Category::class);
38+
$this->categoryRepositoryPluginMock = new CategoryRepositoryPlugin();
39+
}
40+
41+
/**
42+
* Test beforeSave method
43+
*/
44+
public function testBeforeSave()
45+
{
46+
$attributeMock = $this->createMock(AttributeInterface::class);
47+
$urlKey = 'new test Cat (1)!';
48+
$formattedUrlKey = 'new-test-cat-1';
49+
$this->categoryMock->method('getCustomAttribute')
50+
->willReturnMap([
51+
['url_key', $attributeMock],
52+
['url_path', $attributeMock],
53+
]);
54+
55+
$this->categoryMock->method('getData')
56+
->willReturn($urlKey);
57+
58+
$this->categoryMock->method('formatUrlKey')
59+
->willReturn($formattedUrlKey);
60+
61+
$result = $this->categoryRepositoryPluginMock->beforeSave($this->categoryRepositoryMock, $this->categoryMock);
62+
$this->assertSame([$this->categoryMock], $result);
63+
}
64+
}

app/code/Magento/Catalog/etc/webapi_rest/di.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2014 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -44,4 +44,7 @@
4444
<plugin name="reindex_after_save_product_links" type="Magento\Catalog\Plugin\Api\ProductLinkRepositoryInterface\ReindexAfterSaveProductLinksPlugin"/>
4545
<plugin name="reindex_after_delete_by_id_product_links" type="Magento\Catalog\Plugin\Api\ProductLinkRepositoryInterface\ReindexAfterDeleteByIdProductLinksPlugin"/>
4646
</type>
47+
<type name="Magento\Catalog\Model\CategoryRepository">
48+
<plugin name="format_category_url_key_rest_api" type="Magento\Catalog\Plugin\Model\CategoryRepositoryPlugin" />
49+
</type>
4750
</config>

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductName.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function resolve(
3434
Field $field,
3535
$context,
3636
ResolveInfo $info,
37-
array $value = null,
38-
array $args = null
37+
?array $value = null,
38+
?array $args = null
3939
): string {
4040
if (!isset($value['model'])) {
4141
throw new LocalizedException(__('"model" value should be specified'));

app/code/Magento/CatalogSearch/view/adminhtml/web/js/search-engine-comment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require([
1717
'It is recommended to use OpenSearch as a search engine instead.'),
1818
updateCommentText = () => {
1919
const engineValue = engineField.val(),
20-
newCommentText = ['elasticsearch7', 'elasticsearch8'].includes(engineValue) ?
20+
newCommentText = ['elasticsearch8'].includes(engineValue) ?
2121
unsupportedText : defaultText;
2222

2323
if (commentContainer.text() !== newCommentText) {

app/code/Magento/Config/Test/Mftf/ActionGroup/ChooseElasticSearchAsSearchEngineActionGroup.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
4+
* Copyright 2022 Adobe
5+
* All Rights Reserved.
6+
*/
77
-->
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="ChooseElasticSearchAsSearchEngineActionGroup">
1212
<annotations>
13-
<description>Goes to the 'Configuration' page for 'Catalog'. Sets the 'Search Engine' to 'elasticsearch7'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description>
13+
<description>Goes to the 'Configuration' page for 'Catalog'. Sets the 'Search Engine' to 'elasticsearch8'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description>
1414
</annotations>
1515

1616
<amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="configureSearchEngine"/>
@@ -19,7 +19,7 @@
1919
<conditionalClick selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" dependentSelector="{{AdminCatalogSearchConfigurationSection.checkIfCatalogSearchTabExpand}}" visible="true" stepKey="expandCatalogSearchTab"/>
2020
<waitForElementVisible selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" stepKey="waitForDropdownToBeVisible"/>
2121
<uncheckOption selector="{{AdminCatalogSearchConfigurationSection.searchEngineDefaultSystemValue}}" stepKey="uncheckUseSystemValue"/>
22-
<selectOption selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" userInput="Elasticsearch 7" stepKey="chooseES5"/>
22+
<selectOption selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" userInput="Elasticsearch 8" stepKey="chooseES5"/>
2323
<!--<scrollTo selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" stepKey="scrollToCatalogSearchTab2"/>-->
2424
<!--<click selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" stepKey="collapseCatalogSearchTab"/>-->
2525
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/>

app/code/Magento/Elasticsearch/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"magento/module-store": "*",
1313
"magento/module-catalog-inventory": "*",
1414
"magento/framework": "*",
15-
"magento/elasticsearch": "^1.0.0"
15+
"elasticsearch/elasticsearch": "^8.15"
1616
},
1717
"suggest": {
1818
"magento/module-config": "*"

app/code/Magento/Elasticsearch7/Block/Adminhtml/System/Config/TestConnection.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

app/code/Magento/Elasticsearch7/README.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)