Skip to content

Commit 20dfcc6

Browse files
authored
Merge branch '2.4-develop' into feature/review-graphql-261
2 parents 9b8912e + f824b9e commit 20dfcc6

File tree

260 files changed

+5027
-17285
lines changed

Some content is hidden

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

260 files changed

+5027
-17285
lines changed

app/code/Magento/AdvancedSearch/Model/Client/ClientResolver.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*/
66
namespace Magento\AdvancedSearch\Model\Client;
77

8-
use \Magento\Framework\ObjectManagerInterface;
8+
use Magento\Framework\ObjectManagerInterface;
99
use Magento\Framework\Search\EngineResolverInterface;
10+
use Magento\Framework\App\Config\ScopeConfigInterface;
1011

1112
/**
1213
* @api
@@ -46,7 +47,7 @@ class ClientResolver
4647
private $clientOptionsPool;
4748

4849
/**
49-
* @var EngineResolver
50+
* @var EngineResolverInterface
5051
*/
5152
private $engineResolver;
5253

app/code/Magento/AdvancedSearch/Model/Indexer/Fulltext/Plugin/CustomerGroup.php

+2-14
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
use Magento\Framework\Model\AbstractModel;
1313
use Magento\Catalog\Model\ResourceModel\Attribute;
1414
use Magento\AdvancedSearch\Model\Client\ClientOptionsInterface;
15-
use Magento\Framework\Search\EngineResolverInterface;
16-
use Magento\Search\Model\EngineResolver;
1715

1816
class CustomerGroup extends AbstractPlugin
1917
{
@@ -22,24 +20,16 @@ class CustomerGroup extends AbstractPlugin
2220
*/
2321
protected $clientOptions;
2422

25-
/**
26-
* @var EngineResolverInterface
27-
*/
28-
protected $engineResolver;
29-
3023
/**
3124
* @param IndexerRegistry $indexerRegistry
3225
* @param ClientOptionsInterface $clientOptions
33-
* @param EngineResolverInterface $engineResolver
3426
*/
3527
public function __construct(
3628
IndexerRegistry $indexerRegistry,
37-
ClientOptionsInterface $clientOptions,
38-
EngineResolverInterface $engineResolver
29+
ClientOptionsInterface $clientOptions
3930
) {
4031
parent::__construct($indexerRegistry);
4132
$this->clientOptions = $clientOptions;
42-
$this->engineResolver = $engineResolver;
4333
}
4434

4535
/**
@@ -56,9 +46,7 @@ public function aroundSave(
5646
\Closure $proceed,
5747
AbstractModel $group
5848
) {
59-
$needInvalidation =
60-
($this->engineResolver->getCurrentSearchEngine() != EngineResolver::CATALOG_SEARCH_MYSQL_ENGINE)
61-
&& ($group->isObjectNew() || $group->dataHasChangedFor('tax_class_id'));
49+
$needInvalidation = $group->isObjectNew() || $group->dataHasChangedFor('tax_class_id');
6250
$result = $proceed($group);
6351
if ($needInvalidation) {
6452
$this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();

app/code/Magento/AdvancedSearch/Test/Unit/Model/Indexer/Fulltext/Plugin/CustomerGroupTest.php

+7-27
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use Magento\Customer\Model\ResourceModel\Group as CustomerGroupResourceModel;
1515
use Magento\Framework\Indexer\IndexerInterface;
1616
use Magento\Framework\Indexer\IndexerRegistry;
17-
use Magento\Framework\Search\EngineResolverInterface;
1817
use PHPUnit\Framework\TestCase;
18+
use PHPUnit\Framework\MockObject\MockObject;
1919

2020
/**
2121
* @covers \Magento\AdvancedSearch\Model\Indexer\Fulltext\Plugin\CustomerGroup
@@ -35,7 +35,7 @@ class CustomerGroupTest extends TestCase
3535
private $indexerMock;
3636

3737
/**
38-
* @var Group|MockObject
38+
* @var CustomerGroupResourceModel|MockObject
3939
*/
4040
private $subjectMock;
4141

@@ -49,11 +49,6 @@ class CustomerGroupTest extends TestCase
4949
*/
5050
private $indexerRegistryMock;
5151

52-
/**
53-
* @var EngineResolverInterface|MockObject
54-
*/
55-
private $engineResolverMock;
56-
5752
protected function setUp(): void
5853
{
5954
$this->subjectMock = $this->createMock(CustomerGroupResourceModel::class);
@@ -73,35 +68,24 @@ protected function setUp(): void
7368
IndexerRegistry::class,
7469
['get']
7570
);
76-
$this->engineResolverMock = $this->createPartialMock(
77-
EngineResolverInterface::class,
78-
['getCurrentSearchEngine']
79-
);
8071
$this->model = new CustomerGroupPlugin(
8172
$this->indexerRegistryMock,
82-
$this->customerOptionsMock,
83-
$this->engineResolverMock
73+
$this->customerOptionsMock
8474
);
8575
}
8676

8777
/**
88-
* @param string $searchEngine
8978
* @param bool $isObjectNew
9079
* @param bool $isTaxClassIdChanged
9180
* @param int $invalidateCounter
9281
* @return void
9382
* @dataProvider aroundSaveDataProvider
9483
*/
9584
public function testAroundSave(
96-
string $searchEngine,
9785
bool $isObjectNew,
9886
bool $isTaxClassIdChanged,
9987
int $invalidateCounter
10088
): void {
101-
$this->engineResolverMock->expects($this->once())
102-
->method('getCurrentSearchEngine')
103-
->willReturn($searchEngine);
104-
10589
$groupMock = $this->createPartialMock(
10690
CustomerGroupModel::class,
10791
['dataHasChangedFor', 'isObjectNew', '__wakeup']
@@ -137,14 +121,10 @@ public function testAroundSave(
137121
public function aroundSaveDataProvider(): array
138122
{
139123
return [
140-
['mysql', false, false, 0],
141-
['mysql', false, true, 0],
142-
['mysql', true, false, 0],
143-
['mysql', true, true, 0],
144-
['custom', false, false, 0],
145-
['custom', false, true, 1],
146-
['custom', true, false, 1],
147-
['custom', true, true, 1],
124+
[false, false, 0],
125+
[false, true, 1],
126+
[true, false, 1],
127+
[true, true, 1],
148128
];
149129
}
150130
}

app/code/Magento/Backend/etc/adminhtml/system.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@
341341
</group>
342342
<group id="upload_configuration" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="1">
343343
<label>Images Upload Configuration</label>
344-
<field id="enable_resize" translate="label" type="select" sortOrder="200" showInDefault="1" canRestore="1">
344+
<field id="enable_resize" translate="label comment" type="select" sortOrder="200" showInDefault="1" canRestore="1">
345345
<label>Enable Frontend Resize</label>
346346
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
347347
<comment>Resize performed via javascript before file upload.</comment>
@@ -459,9 +459,7 @@
459459
<label>Add Store Code to Urls</label>
460460
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
461461
<backend_model>Magento\Config\Model\Config\Backend\Store</backend_model>
462-
<comment>
463-
<![CDATA[<strong style="color:red">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).]]>
464-
</comment>
462+
<comment><![CDATA[<strong style="color:red">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).]]></comment>
465463
</field>
466464
<field id="redirect_to_base" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
467465
<label>Auto-redirect to Base URL</label>

app/code/Magento/Backend/i18n/en_US.csv

+3-5
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,9 @@ Security,Security
403403
Web,Web
404404
"Url Options","Url Options"
405405
"Add Store Code to Urls","Add Store Code to Urls"
406-
"
407-
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).
408-
","
409-
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).
410-
"
406+
"<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).","<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.)."
407+
"Enable Frontend Resize","Enable Frontend Resize"
408+
"Resize performed via javascript before file upload.","Resize performed via javascript before file upload."
411409
"Auto-redirect to Base URL","Auto-redirect to Base URL"
412410
"Search Engine Optimization","Search Engine Optimization"
413411
"Use Web Server Rewrites","Use Web Server Rewrites"

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdvanceCatalogSearchBundleBySkuWithHyphenTest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<group value="Bundle"/>
2020
<group value="SearchEngineElasticsearch"/>
2121
<skip>
22-
<issueId value="MC-21228"/>
22+
<issueId value="MC-34217"/>
2323
</skip>
2424
</annotations>
2525
<before>

app/code/Magento/Captcha/Controller/Refresh/Index.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
namespace Magento\Captcha\Controller\Refresh;
99

1010
use Magento\Captcha\Helper\Data as CaptchaHelper;
11+
use Magento\Framework\App\Action\Action;
12+
use Magento\Framework\App\Action\Context;
1113
use Magento\Framework\App\Action\HttpPostActionInterface;
1214
use Magento\Framework\App\RequestInterface;
1315
use Magento\Framework\Controller\Result\JsonFactory as JsonResultFactory;
@@ -18,7 +20,7 @@
1820
* Refreshes captcha and returns JSON encoded URL to image (AJAX action)
1921
* Example: {'imgSrc': 'http://example.com/media/captcha/67842gh187612ngf8s.png'}
2022
*/
21-
class Index implements HttpPostActionInterface
23+
class Index extends Action implements HttpPostActionInterface
2224
{
2325
/**
2426
* @var CaptchaHelper
@@ -46,19 +48,22 @@ class Index implements HttpPostActionInterface
4648
private $jsonResultFactory;
4749

4850
/**
51+
* @param Context $context
4952
* @param RequestInterface $request
5053
* @param JsonResultFactory $jsonFactory
5154
* @param CaptchaHelper $captchaHelper
5255
* @param LayoutInterface $layout
5356
* @param JsonSerializer $serializer
5457
*/
5558
public function __construct(
59+
Context $context,
5660
RequestInterface $request,
5761
JsonResultFactory $jsonFactory,
5862
CaptchaHelper $captchaHelper,
5963
LayoutInterface $layout,
6064
JsonSerializer $serializer
6165
) {
66+
parent::__construct($context);
6267
$this->request = $request;
6368
$this->jsonResultFactory = $jsonFactory;
6469
$this->captchaHelper = $captchaHelper;

app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Captcha\Controller\Refresh\Index;
1111
use Magento\Captcha\Helper\Data as CaptchaHelper;
1212
use Magento\Captcha\Model\CaptchaInterface;
13+
use Magento\Framework\App\Action\Context;
1314
use Magento\Framework\App\RequestInterface;
1415
use Magento\Framework\Controller\Result\Json as ResultJson;
1516
use Magento\Framework\Controller\Result\JsonFactory as ResultJsonFactory;
@@ -45,6 +46,9 @@ class IndexTest extends TestCase
4546
/** @var MockObject|JsonSerializer */
4647
private $jsonSerializerMock;
4748

49+
/** @var MockObject|Context */
50+
private $contextMock;
51+
4852
/** @var Index */
4953
private $refreshAction;
5054

@@ -66,13 +70,16 @@ protected function setUp(): void
6670
$this->jsonSerializerMock = $this->createMock(JsonSerializer::class);
6771
$this->captchaHelperMock = $this->createMock(CaptchaHelper::class);
6872

73+
$this->contextMock = $this->createMock(Context::class);
74+
6975
$this->blockMock->method('setIsAjax')
7076
->willReturnSelf();
7177

7278
$this->layoutMock->method('createBlock')
7379
->willReturn($this->blockMock);
7480

7581
$this->refreshAction = new Index(
82+
$this->contextMock,
7683
$this->requestMock,
7784
$this->jsonResultFactoryMock,
7885
$this->captchaHelperMock,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\Product\Webapi\Rest;
9+
10+
use Magento\Framework\Webapi\Rest\Request\DeserializerInterface;
11+
use Magento\Framework\Webapi\Rest\Request\DeserializerFactory;
12+
use Magento\Framework\Webapi\Rest\Request;
13+
14+
/**
15+
* Class RequestTypeBasedDeserializer
16+
*
17+
* Used for deserialization rest request body.
18+
* Runs appropriate deserialization class object based on request body content type.
19+
*/
20+
class RequestTypeBasedDeserializer implements DeserializerInterface
21+
{
22+
/**
23+
* @var Request
24+
*/
25+
private $request;
26+
27+
/**
28+
* @var DeserializerFactory
29+
*/
30+
private $deserializeFactory;
31+
32+
/**
33+
* RequestTypeBasedDeserializer constructor.
34+
*
35+
* @param DeserializerFactory $deserializeFactory
36+
* @param Request $request
37+
*/
38+
public function __construct(
39+
DeserializerFactory $deserializeFactory,
40+
Request $request
41+
) {
42+
$this->deserializeFactory = $deserializeFactory;
43+
$this->request = $request;
44+
}
45+
46+
/**
47+
* @inheritdoc
48+
*
49+
* Parse request body into array of params with identifying request body content type
50+
* to use appropriate instance of deserializer class
51+
*
52+
* @param string $body Posted content from request
53+
* @return array|null Return NULL if content is invalid
54+
* @throws \Magento\Framework\Exception\InputException
55+
* @throws \Magento\Framework\Webapi\Exception
56+
*/
57+
public function deserialize($body)
58+
{
59+
$deserializer = $this->deserializeFactory->get($this->request->getContentType());
60+
return $deserializer->deserialize($body);
61+
}
62+
}

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

+7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
3636
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
3737
</entity>
38+
<entity name="ApiSimpleProductWithNoSpace" type="product" extends="ApiSimpleProduct">
39+
<data key="name">TestFooBar</data>
40+
<data key="sku" unique="suffix">foobar</data>
41+
</entity>
3842
<entity name="ApiSimpleProductWithSpecCharInName" type="product" extends="ApiSimpleProduct">
3943
<data key="name">Pursuit Lumaflex&#38;trade; Tone Band</data>
4044
<data key="sku" unique="suffix">x&#38;trade;</data>
@@ -68,6 +72,9 @@
6872
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
6973
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
7074
</entity>
75+
<entity name="ProductForPartialSearch" extends="SimpleProduct" type="product">
76+
<data key="sku">partialTestSku</data>
77+
</entity>
7178
<entity name="ProductWithSpecialSymbols" extends="SimpleProduct" type="product">
7279
<data key="name">SimpleProduct -+~/\\&lt;&gt;\’“:*\$#@()!,.?`=%&amp;^</data>
7380
</entity>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<group value="Catalog"/>
2020
<group value="SearchEngineElasticsearch"/>
2121
<skip>
22-
<issueId value="MC-21228"/>
22+
<issueId value="MC-34217"/>
2323
</skip>
2424
</annotations>
2525
<before>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<group value="Catalog"/>
2020
<group value="SearchEngineElasticsearch"/>
2121
<skip>
22-
<issueId value="MC-21228"/>
22+
<issueId value="MC-34217"/>
2323
</skip>
2424
</annotations>
2525
<before>

0 commit comments

Comments
 (0)