Skip to content

Commit 6756b03

Browse files
authored
Merge branch '2.4-develop' into multicoupon
2 parents 80a353c + bfea788 commit 6756b03

File tree

201 files changed

+6838
-1779
lines changed

Some content is hidden

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

201 files changed

+6838
-1779
lines changed
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/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/AwsS3/Test/Mftf/Test/AdminAwsS3SyncZeroByteFilesTest.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
<!-- Disable AWS S3 Remote Storage -->
4545
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage"/>
4646
</after>
47-
<magentoCLI command="remote-storage:sync" timeout="120" stepKey="syncRemoteStorage"/>
48-
<assertEquals stepKey="assertConfigTest">
49-
<expectedResult type="string">Uploading media files to remote storage.\n- empty.jpg\nEnd of upload.</expectedResult>
47+
<magentoCLI command="remote-storage:sync" timeout="200" stepKey="syncRemoteStorage"/>
48+
<comment userInput="checking remote-storage:sync" stepKey="assertConfigTest"/>
49+
<assertStringContainsString stepKey="checkingRemoteStorageSync">
50+
<expectedResult type="string">Uploading media files to remote storage</expectedResult>
5051
<actualResult type="variable">$syncRemoteStorage</actualResult>
51-
</assertEquals>
52-
52+
</assertStringContainsString>
5353
</test>
5454
</tests>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCheckCurrencyDefaultSystemValuesActionGroup">
12+
<annotations>
13+
<description> Admin check default currency system values.</description>
14+
</annotations>
15+
<waitForElementClickable selector="{{CurrencySetupSection.currencyOptions}}" stepKey="waitForCurrencyOptionsHeaderToBeClickable"/>
16+
<conditionalClick selector="{{CurrencySetupSection.currencyOptions}}" dependentSelector="{{CurrencySetupSection.CheckCurrencyOptionsIfTabExpand}}" stepKey="checkCurrencyTabOpen" visible="true"/>
17+
<conditionalClick selector="{{CurrencySetupSection.baseCurrencyUseDefault}}" dependentSelector="{{CurrencySetupSection.baseCurrencyUseDefault}}" stepKey="checkBaseCurrencySystemValue" visible="true"/>
18+
<waitForElementClickable selector="{{CurrencySetupSection.defaultdisplayCurrency}}" stepKey="waitForDisplayCurrencySystemToBeClickable"/>
19+
<checkOption selector="{{CurrencySetupSection.defaultdisplayCurrency}}" stepKey="checkDisplayCurrencySystemValue"/>
20+
<waitForElementClickable selector="{{CurrencySetupSection.allowcurrenciescheckbox}}" stepKey="waitForAllowedCurrencySystemToBeClickable"/>
21+
<checkOption selector="{{CurrencySetupSection.allowcurrenciescheckbox}}" stepKey="checkAllowedCyCurrencySystemValue"/>
22+
</actionGroup>
23+
</actionGroups>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminConfigureCurrenciesActionGroup">
12+
<annotations>
13+
<description> Admin uncheck currency option system values.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="baseValue" type="string" defaultValue="Norwegian Krone"/>
17+
<argument name="defaultValue" type="string" defaultValue="British Pound"/>
18+
<argument name="allowedValue" type="string" defaultValue="['British Pound']"/>
19+
</arguments>
20+
<waitForElementVisible selector="{{AdminConfigSection.baseCurrency}}" stepKey="waitForBaseCurrencyToVisible"/>
21+
<selectOption selector="{{AdminConfigSection.baseCurrency}}" userInput="{{baseValue}}" stepKey="selectBaseCurrency"/>
22+
<waitForElementVisible selector="{{AdminConfigSection.defaultCurrency}}" stepKey="waitForDefaultCurrencyToVisible"/>
23+
<selectOption selector="{{AdminConfigSection.defaultCurrency}}" userInput="{{defaultValue}}" stepKey="selectDefaultDisplayCurrency"/>
24+
<waitForElementVisible selector="{{AdminConfigSection.allowedCurrencies}}" stepKey="waitForAllowedCurrencyToVisible"/>
25+
<selectOption selector="{{AdminConfigSection.allowedCurrencies}}" parameterArray="{{allowedValue}}" stepKey="selectAllowedDisplayCurrency"/>
26+
</actionGroup>
27+
</actionGroups>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminUnCheckCurrencyOptionsSystemValuesActionGroup">
12+
<annotations>
13+
<description> Admin uncheck currency option system values.</description>
14+
</annotations>
15+
<waitForElementClickable selector="{{CurrencySetupSection.currencyOptions}}" stepKey="waitForCurrencyOptionsHeaderToBeClickable"/>
16+
<conditionalClick selector="{{CurrencySetupSection.currencyOptions}}" dependentSelector="{{CurrencySetupSection.CheckCurrencyOptionsIfTabExpand}}" stepKey="checkCurrencyTabOpen" visible="true"/>
17+
<waitForElementClickable selector="{{CurrencySetupSection.baseCurrencyUseDefault}}" stepKey="waitForBaseCurrencySystemToBeClickable"/>
18+
<uncheckOption selector="{{CurrencySetupSection.baseCurrencyUseDefault}}" stepKey="unCheckBaseCurrencySystemValue"/>
19+
<waitForElementClickable selector="{{CurrencySetupSection.defaultdisplayCurrency}}" stepKey="waitForDisplayCurrencySystemToBeClickable"/>
20+
<uncheckOption selector="{{CurrencySetupSection.defaultdisplayCurrency}}" stepKey="unCheckDisplayCurrencySystemValue"/>
21+
<waitForElementClickable selector="{{CurrencySetupSection.allowcurrenciescheckbox}}" stepKey="waitForAllowedCurrencySystemToBeClickable"/>
22+
<uncheckOption selector="{{CurrencySetupSection.allowcurrenciescheckbox}}" stepKey="unCheckAllowedCyCurrencySystemValue"/>
23+
</actionGroup>
24+
</actionGroups>

app/code/Magento/BundleGraphQl/Model/Cart/BuyRequest/BundleDataProvider.php

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

88
namespace Magento\BundleGraphQl\Model\Cart\BuyRequest;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\Stdlib\ArrayManager;
12+
use Magento\Framework\Stdlib\ArrayManagerFactory;
1113
use Magento\QuoteGraphQl\Model\Cart\BuyRequest\BuyRequestDataProviderInterface;
1214

1315
/**
@@ -16,17 +18,23 @@
1618
class BundleDataProvider implements BuyRequestDataProviderInterface
1719
{
1820
/**
19-
* @var ArrayManager
21+
* @var ArrayManagerFactory
22+
* phpcs:disable Magento2.Commenting.ClassPropertyPHPDocFormatting
2023
*/
21-
private $arrayManager;
24+
private readonly ArrayManagerFactory $arrayManagerFactory;
2225

2326
/**
24-
* @param ArrayManager $arrayManager
27+
* @param ArrayManager $arrayManager @deprecated @see $arrayManagerFactory
28+
* @param ArrayManagerFactory|null $arrayManagerFactory
29+
*
30+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2531
*/
2632
public function __construct(
27-
ArrayManager $arrayManager
33+
ArrayManager $arrayManager,
34+
?ArrayManagerFactory $arrayManagerFactory = null,
2835
) {
29-
$this->arrayManager = $arrayManager;
36+
$this->arrayManagerFactory = $arrayManagerFactory
37+
?? ObjectManager::getInstance()->get(ArrayManagerFactory::class);
3038
}
3139

3240
/**
@@ -35,7 +43,7 @@ public function __construct(
3543
public function execute(array $cartItemData): array
3644
{
3745
$bundleOptions = [];
38-
$bundleInputs = $this->arrayManager->get('bundle_options', $cartItemData) ?? [];
46+
$bundleInputs = $this->arrayManagerFactory->create()->get('bundle_options', $cartItemData) ?? [];
3947
foreach ($bundleInputs as $bundleInput) {
4048
$bundleOptions['bundle_option'][$bundleInput['id']] = $bundleInput['value'];
4149
$bundleOptions['bundle_option_qty'][$bundleInput['id']] = $bundleInput['quantity'];

0 commit comments

Comments
 (0)