Skip to content

Commit 3f7f313

Browse files
authored
Merge branch '2.4-develop' into multiple-post-request
2 parents e3c7d1b + 03621bb commit 3f7f313

File tree

1,419 files changed

+35952
-10460
lines changed

Some content is hidden

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

1,419 files changed

+35952
-10460
lines changed

.github/CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Contributions to the Magento 2 codebase are done using the fork & pull model.
44
This contribution model has contributors maintaining their own fork of the Magento 2 repository.
5-
The forked repository is then used to submit a request to the base repository to pull a set of changes.
5+
The forked repository is then used to submit a request to the base repository to "pull" a set of changes.
66
For more information on pull requests please refer to [GitHub Help](https://help.github.com/articles/about-pull-requests/).
77

88
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes or optimizations.
@@ -19,11 +19,11 @@ For more detailed information on contribution please read our [beginners guide](
1919
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request being merged quickly and without additional clarification requests.
2020
3. Commits must be accompanied by meaningful commit messages. Please see the [Magento Pull Request Template](https://github.com/magento/magento2/blob/HEAD/.github/PULL_REQUEST_TEMPLATE.md) for more information.
2121
4. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug.
22-
3. PRs which include new logic or new features must be submitted along with:
23-
* Unit/integration test coverage
24-
* Proposed [documentation](https://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
25-
4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
26-
5. All automated tests must pass.
22+
5. PRs which include new logic or new features must be submitted along with:
23+
* Unit/integration test coverage
24+
* Proposed [documentation](https://developer.adobe.com/commerce) updates. Use feedback buttons __Edit in GitHub__ and __Log an issue__ at the top of a relevant topic.
25+
6. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
26+
7. All automated tests must pass.
2727

2828
## Contribution process
2929

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ However, for those who need a full-featured eCommerce solution, we recommend [Ad
2626

2727
## Contribute
2828

29-
Our [Community](https://opensource.magento.com/) is large and diverse, and our project is enormous. As a contributor, you have countless opportunities to impact product development and delivery by introducing new features or improving existing ones, enhancing test coverage, updating documentation for [developers](https://developer.adobe.com/commerce/docs/) and [end-users](https://docs.magento.com/user-guide/), catching and fixing code bugs, suggesting points for optimization, and sharing your great ideas.
29+
Our [Community](https://opensource.magento.com/) is large and diverse, and our project is enormous. As a contributor, you have countless opportunities to impact product development and delivery by introducing new features or improving existing ones, enhancing test coverage, updating documentation for [developers](https://developer.adobe.com/commerce/docs/) and [end-users](https://experienceleague.adobe.com/docs/commerce-admin/user-guides/home.html), catching and fixing code bugs, suggesting points for optimization, and sharing your great ideas.
3030

3131
- [Contribute to the code](https://developer.adobe.com/commerce/contributor/guides/code-contributions/)
3232
- [Report an issue](https://developer.adobe.com/commerce/contributor/guides/code-contributions/#report)

app/code/Magento/AdminAnalytics/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"sort-packages": true
66
},
77
"require": {
8-
"php": "~8.1.0||~8.2.0",
8+
"php": "~8.1.0||~8.2.0||~8.3.0",
99
"magento/framework": "*",
1010
"magento/module-backend": "*",
1111
"magento/module-config": "*",

app/code/Magento/AdminNotification/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"sort-packages": true
66
},
77
"require": {
8-
"php": "~8.1.0||~8.2.0",
8+
"php": "~8.1.0||~8.2.0||~8.3.0",
99
"lib-libxml": "*",
1010
"magento/framework": "*",
1111
"magento/module-backend": "*",

app/code/Magento/AdvancedPricingImportExport/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"sort-packages": true
66
},
77
"require": {
8-
"php": "~8.1.0||~8.2.0",
8+
"php": "~8.1.0||~8.2.0||~8.3.0",
99
"magento/framework": "*",
1010
"magento/module-catalog": "*",
1111
"magento/module-catalog-import-export": "*",
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
/************************************************************************
3+
*
4+
* Copyright 2023 Adobe
5+
* All Rights Reserved.
6+
*
7+
* NOTICE: All information contained herein is, and remains
8+
* the property of Adobe and its suppliers, if any. The intellectual
9+
* and technical concepts contained herein are proprietary to Adobe
10+
* and its suppliers and are protected by all applicable intellectual
11+
* property laws, including trade secret and copyright laws.
12+
* Dissemination of this information or reproduction of this material
13+
* is strictly forbidden unless prior written permission is obtained
14+
* from Adobe.
15+
* ***********************************************************************
16+
*/
17+
declare(strict_types=1);
18+
19+
namespace Magento\AdvancedSearch\Model\DataProvider;
20+
21+
use Magento\Search\Model\Autocomplete\DataProviderInterface;
22+
use Magento\Search\Model\Autocomplete\ItemFactory;
23+
use Magento\Search\Model\QueryFactory;
24+
use Magento\Framework\App\Config\ScopeConfigInterface as ScopeConfig;
25+
use Magento\AdvancedSearch\Model\SuggestedQueries;
26+
use Magento\CatalogSearch\Model\Autocomplete\DataProvider;
27+
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;
28+
use Magento\Store\Model\ScopeInterface;
29+
30+
class AutocompleteSuggestions implements DataProviderInterface
31+
{
32+
/**
33+
* @var QueryFactory
34+
*/
35+
private $queryFactory;
36+
37+
/**
38+
* @var ItemFactory
39+
*/
40+
private $itemFactory;
41+
42+
/**
43+
* @var SuggestedQueries
44+
*/
45+
private $suggestedQueries;
46+
47+
/**
48+
* @var DataProvider
49+
*/
50+
private $dataProvider;
51+
52+
/**
53+
* @var ScopeConfig
54+
*/
55+
private $scopeConfig;
56+
57+
/**
58+
* @param QueryFactory $queryFactory
59+
* @param ItemFactory $itemFactory
60+
* @param ScopeConfig $scopeConfig
61+
* @param SuggestedQueries $suggestedQueries
62+
* @param DataProvider $dataProvider
63+
*/
64+
public function __construct(
65+
QueryFactory $queryFactory,
66+
ItemFactory $itemFactory,
67+
ScopeConfig $scopeConfig,
68+
SuggestedQueries $suggestedQueries,
69+
DataProvider $dataProvider
70+
) {
71+
$this->queryFactory = $queryFactory;
72+
$this->itemFactory = $itemFactory;
73+
$this->suggestedQueries = $suggestedQueries;
74+
$this->dataProvider = $dataProvider;
75+
$this->scopeConfig = $scopeConfig;
76+
}
77+
78+
/**
79+
* @inheritdoc
80+
*/
81+
public function getItems()
82+
{
83+
$result = [];
84+
if ($this->scopeConfig->isSetFlag(
85+
SuggestedQueriesInterface::SEARCH_SUGGESTION_ENABLED,
86+
ScopeInterface::SCOPE_STORE
87+
)) {
88+
// populate with search suggestions
89+
$query = $this->queryFactory->get();
90+
$suggestions = $this->suggestedQueries->getItems($query);
91+
foreach ($suggestions as $suggestion) {
92+
$resultItem = $this->itemFactory->create([
93+
'title' => $suggestion->getQueryText(),
94+
'num_results' => $suggestion->getResultsCount(),
95+
]);
96+
$result[] = $resultItem;
97+
}
98+
} else {
99+
// populate with autocomplete
100+
$result = $this->dataProvider->getItems();
101+
}
102+
return $result;
103+
}
104+
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<?php
2+
/************************************************************************
3+
*
4+
* Copyright 2023 Adobe
5+
* All Rights Reserved.
6+
*
7+
* NOTICE: All information contained herein is, and remains
8+
* the property of Adobe and its suppliers, if any. The intellectual
9+
* and technical concepts contained herein are proprietary to Adobe
10+
* and its suppliers and are protected by all applicable intellectual
11+
* property laws, including trade secret and copyright laws.
12+
* Dissemination of this information or reproduction of this material
13+
* is strictly forbidden unless prior written permission is obtained
14+
* from Adobe.
15+
* ***********************************************************************
16+
*/
17+
declare(strict_types=1);
18+
19+
namespace Magento\AdvancedSearch\Test\Unit\Model\DataProvider;
20+
21+
use Magento\AdvancedSearch\Model\DataProvider\AutocompleteSuggestions;
22+
use Magento\Search\Model\Autocomplete\ItemFactory;
23+
use Magento\Search\Model\QueryFactory;
24+
use Magento\Framework\App\Config\ScopeConfigInterface as ScopeConfig;
25+
use Magento\AdvancedSearch\Model\SuggestedQueries;
26+
use Magento\CatalogSearch\Model\Autocomplete\DataProvider;
27+
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;
28+
use Magento\Store\Model\ScopeInterface;
29+
use Magento\Search\Model\Query;
30+
use PHPUnit\Framework\MockObject\MockObject;
31+
use PHPUnit\Framework\TestCase;
32+
33+
class AutocompleteSuggestionsTest extends TestCase
34+
{
35+
/**
36+
* @var AutocompleteSuggestions
37+
*/
38+
private $model;
39+
40+
/**
41+
* @var QueryFactory|MockObject
42+
*/
43+
private $queryFactory;
44+
45+
/**
46+
* @var ItemFactory|MockObject
47+
*/
48+
private $itemFactory;
49+
50+
/**
51+
* @var SuggestedQueries|MockObject
52+
*/
53+
private $suggestedQueries;
54+
55+
/**
56+
* @var DataProvider|MockObject
57+
*/
58+
private $dataProvider;
59+
60+
/**
61+
* @var ScopeConfig|MockObject
62+
*/
63+
private $scopeConfig;
64+
65+
/**
66+
* @var Query|MockObject
67+
*/
68+
private $query;
69+
70+
protected function setUp(): void
71+
{
72+
$this->queryFactory = $this->getMockBuilder(QueryFactory::class)
73+
->disableOriginalConstructor()
74+
->getMock();
75+
$this->itemFactory = $this->getMockBuilder(ItemFactory::class)
76+
->disableOriginalConstructor()
77+
->getMock();
78+
$this->suggestedQueries = $this->getMockBuilder(SuggestedQueries::class)
79+
->disableOriginalConstructor()
80+
->getMock();
81+
$this->dataProvider = $this->getMockBuilder(DataProvider::class)
82+
->disableOriginalConstructor()
83+
->getMock();
84+
$this->scopeConfig = $this->getMockBuilder(ScopeConfig::class)
85+
->getMockForAbstractClass();
86+
$this->query = $this->getMockBuilder(Query::class)
87+
->disableOriginalConstructor()
88+
->getMock();
89+
$this->queryFactory->expects($this->any())
90+
->method('get')
91+
->willReturn($this->query);
92+
93+
$this->model = new AutocompleteSuggestions(
94+
$this->queryFactory,
95+
$this->itemFactory,
96+
$this->scopeConfig,
97+
$this->suggestedQueries,
98+
$this->dataProvider
99+
);
100+
}
101+
102+
public function testGetItemsWithEnabledSuggestions(): void
103+
{
104+
$this->scopeConfig->expects($this->once())
105+
->method('isSetFlag')
106+
->with(SuggestedQueriesInterface::SEARCH_SUGGESTION_ENABLED, ScopeInterface::SCOPE_STORE)
107+
->willReturn(true);
108+
$this->suggestedQueries->expects($this->once())
109+
->method('getItems')
110+
->with($this->query)
111+
->willReturn([]);
112+
$this->dataProvider->expects($this->never())
113+
->method('getItems');
114+
$this->assertEquals([], $this->model->getItems());
115+
}
116+
117+
public function testGetItemsWithDisabledSuggestions(): void
118+
{
119+
$this->scopeConfig->expects($this->once())
120+
->method('isSetFlag')
121+
->with(SuggestedQueriesInterface::SEARCH_SUGGESTION_ENABLED, ScopeInterface::SCOPE_STORE)
122+
->willReturn(false);
123+
$this->suggestedQueries->expects($this->never())
124+
->method('getItems');
125+
$this->dataProvider->expects($this->once())
126+
->method('getItems')
127+
->willReturn([]);
128+
$this->assertEquals([], $this->model->getItems());
129+
}
130+
}

app/code/Magento/AdvancedSearch/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"magento/module-customer": "*",
1414
"magento/module-search": "*",
1515
"magento/module-store": "*",
16-
"php": "~8.1.0||~8.2.0"
16+
"php": "~8.1.0||~8.2.0||~8.3.0"
1717
},
1818
"type": "magento2-module",
1919
"license": [

app/code/Magento/AdvancedSearch/etc/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,11 @@
4040
</arguments>
4141
</type>
4242
<preference for="Magento\AdvancedSearch\Model\Adapter\DataMapper\AdditionalFieldsProviderInterface" type="Magento\AdvancedSearch\Model\Adapter\DataMapper\AdditionalFieldsProvider" />
43+
<type name="Magento\Search\Model\Autocomplete">
44+
<arguments>
45+
<argument name="dataProviders" xsi:type="array">
46+
<item name="10" xsi:type="object">Magento\AdvancedSearch\Model\DataProvider\AutocompleteSuggestions</item>
47+
</argument>
48+
</arguments>
49+
</type>
4350
</config>

app/code/Magento/Amqp/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"magento/framework": "*",
99
"magento/framework-amqp": "*",
1010
"magento/framework-message-queue": "*",
11-
"php": "~8.1.0||~8.2.0"
11+
"php": "~8.1.0||~8.2.0||~8.3.0"
1212
},
1313
"type": "magento2-module",
1414
"license": [

0 commit comments

Comments
 (0)