Skip to content

Commit 8b29c30

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into AC-10720
2 parents f4ba4fb + 03621bb commit 8b29c30

File tree

430 files changed

+6927
-2224
lines changed

Some content is hidden

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

430 files changed

+6927
-2224
lines changed

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": [

app/code/Magento/Analytics/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-analytics",
33
"description": "N/A",
44
"require": {
5-
"php": "~8.1.0||~8.2.0",
5+
"php": "~8.1.0||~8.2.0||~8.3.0",
66
"magento/module-backend": "*",
77
"magento/module-config": "*",
88
"magento/module-integration": "*",

app/code/Magento/ApplicationPerformanceMonitor/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
},
1414
"require": {
15-
"php": "~8.1.0||~8.2.0",
15+
"php": "~8.1.0||~8.2.0||~8.3.0",
1616
"magento/framework": "*"
1717
}
1818
}

0 commit comments

Comments
 (0)