Skip to content

Commit

Permalink
Merge branch '2.4-develop' into fix-27489
Browse files Browse the repository at this point in the history
  • Loading branch information
ProkopovVitaliy authored May 28, 2020
2 parents 6b9bf69 + f824b9e commit 2fe9174
Show file tree
Hide file tree
Showing 340 changed files with 6,035 additions and 17,415 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
*/
namespace Magento\AdvancedSearch\Model\Client;

use \Magento\Framework\ObjectManagerInterface;
use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\Search\EngineResolverInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;

/**
* @api
Expand Down Expand Up @@ -46,7 +47,7 @@ class ClientResolver
private $clientOptionsPool;

/**
* @var EngineResolver
* @var EngineResolverInterface
*/
private $engineResolver;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
use Magento\Framework\Model\AbstractModel;
use Magento\Catalog\Model\ResourceModel\Attribute;
use Magento\AdvancedSearch\Model\Client\ClientOptionsInterface;
use Magento\Framework\Search\EngineResolverInterface;
use Magento\Search\Model\EngineResolver;

class CustomerGroup extends AbstractPlugin
{
Expand All @@ -22,24 +20,16 @@ class CustomerGroup extends AbstractPlugin
*/
protected $clientOptions;

/**
* @var EngineResolverInterface
*/
protected $engineResolver;

/**
* @param IndexerRegistry $indexerRegistry
* @param ClientOptionsInterface $clientOptions
* @param EngineResolverInterface $engineResolver
*/
public function __construct(
IndexerRegistry $indexerRegistry,
ClientOptionsInterface $clientOptions,
EngineResolverInterface $engineResolver
ClientOptionsInterface $clientOptions
) {
parent::__construct($indexerRegistry);
$this->clientOptions = $clientOptions;
$this->engineResolver = $engineResolver;
}

/**
Expand All @@ -56,9 +46,7 @@ public function aroundSave(
\Closure $proceed,
AbstractModel $group
) {
$needInvalidation =
($this->engineResolver->getCurrentSearchEngine() != EngineResolver::CATALOG_SEARCH_MYSQL_ENGINE)
&& ($group->isObjectNew() || $group->dataHasChangedFor('tax_class_id'));
$needInvalidation = $group->isObjectNew() || $group->dataHasChangedFor('tax_class_id');
$result = $proceed($group);
if ($needInvalidation) {
$this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
use Magento\Customer\Model\ResourceModel\Group as CustomerGroupResourceModel;
use Magento\Framework\Indexer\IndexerInterface;
use Magento\Framework\Indexer\IndexerRegistry;
use Magento\Framework\Search\EngineResolverInterface;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\MockObject\MockObject;

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

/**
* @var Group|MockObject
* @var CustomerGroupResourceModel|MockObject
*/
private $subjectMock;

Expand All @@ -49,11 +49,6 @@ class CustomerGroupTest extends TestCase
*/
private $indexerRegistryMock;

/**
* @var EngineResolverInterface|MockObject
*/
private $engineResolverMock;

protected function setUp(): void
{
$this->subjectMock = $this->createMock(CustomerGroupResourceModel::class);
Expand All @@ -73,35 +68,24 @@ protected function setUp(): void
IndexerRegistry::class,
['get']
);
$this->engineResolverMock = $this->createPartialMock(
EngineResolverInterface::class,
['getCurrentSearchEngine']
);
$this->model = new CustomerGroupPlugin(
$this->indexerRegistryMock,
$this->customerOptionsMock,
$this->engineResolverMock
$this->customerOptionsMock
);
}

/**
* @param string $searchEngine
* @param bool $isObjectNew
* @param bool $isTaxClassIdChanged
* @param int $invalidateCounter
* @return void
* @dataProvider aroundSaveDataProvider
*/
public function testAroundSave(
string $searchEngine,
bool $isObjectNew,
bool $isTaxClassIdChanged,
int $invalidateCounter
): void {
$this->engineResolverMock->expects($this->once())
->method('getCurrentSearchEngine')
->willReturn($searchEngine);

$groupMock = $this->createPartialMock(
CustomerGroupModel::class,
['dataHasChangedFor', 'isObjectNew', '__wakeup']
Expand Down Expand Up @@ -137,14 +121,10 @@ public function testAroundSave(
public function aroundSaveDataProvider(): array
{
return [
['mysql', false, false, 0],
['mysql', false, true, 0],
['mysql', true, false, 0],
['mysql', true, true, 0],
['custom', false, false, 0],
['custom', false, true, 1],
['custom', true, false, 1],
['custom', true, true, 1],
[false, false, 0],
[false, true, 1],
[true, false, 1],
[true, true, 1],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminFilterLegacyGridActionGroup">
<arguments>
<argument name="fieldSelector" type="string"/>
<argument name="value" type="string"/>
<argument name="button" type="string" defaultValue="{{AdminLegacyDataGridFilterSection.apply}}"/>
</arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<title value="Admin should be able to manage persistent shopping cart settings"/>
<description value="Admin should be able to enable persistent shopping cart in Magento Admin backend and see additional options"/>
<group value="backend"/>
<severity value="MAJOR"/>
</annotations>

<before>
Expand Down
6 changes: 2 additions & 4 deletions app/code/Magento/Backend/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
</group>
<group id="upload_configuration" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Images Upload Configuration</label>
<field id="enable_resize" translate="label" type="select" sortOrder="200" showInDefault="1" canRestore="1">
<field id="enable_resize" translate="label comment" type="select" sortOrder="200" showInDefault="1" canRestore="1">
<label>Enable Frontend Resize</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Resize performed via javascript before file upload.</comment>
Expand Down Expand Up @@ -459,9 +459,7 @@
<label>Add Store Code to Urls</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<backend_model>Magento\Config\Model\Config\Backend\Store</backend_model>
<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>
<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>
</field>
<field id="redirect_to_base" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Auto-redirect to Base URL</label>
Expand Down
8 changes: 3 additions & 5 deletions app/code/Magento/Backend/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,9 @@ Security,Security
Web,Web
"Url Options","Url Options"
"Add Store Code to Urls","Add Store Code to Urls"
"
<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.).
"
"<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.)."
"Enable Frontend Resize","Enable Frontend Resize"
"Resize performed via javascript before file upload.","Resize performed via javascript before file upload."
"Auto-redirect to Base URL","Auto-redirect to Base URL"
"Search Engine Optimization","Search Engine Optimization"
"Use Web Server Rewrites","Use Web Server Rewrites"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminOrderConfigureBundleProduct">
<arguments>
<argument name="productName" type="string" defaultValue="{{SimpleProduct.sku}}"/>
<argument name="productNumber" type="string" defaultValue="1"/>
<argument name="productQty" type="string" defaultValue="1"/>
</arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
</annotations>
<arguments>
<argument name="product" defaultValue="BundleProduct"/>
<argument name="thumbnail" defaultValue="ProductPlaceholderImage"/>
</arguments>

<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<group value="Bundle"/>
<group value="SearchEngineElasticsearch"/>
<skip>
<issueId value="MC-21228"/>
<issueId value="MC-34217"/>
</skip>
</annotations>
<before>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="UpdateBundleProductViaImportTest">
<annotations>
<stories value="Update Bundle product via import"/>
<features value="Import/Export"/>
<title value="Update Bundle product via import"/>
<description
Expand Down
7 changes: 6 additions & 1 deletion app/code/Magento/Captcha/Controller/Refresh/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
namespace Magento\Captcha\Controller\Refresh;

use Magento\Captcha\Helper\Data as CaptchaHelper;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Controller\Result\JsonFactory as JsonResultFactory;
Expand All @@ -18,7 +20,7 @@
* Refreshes captcha and returns JSON encoded URL to image (AJAX action)
* Example: {'imgSrc': 'http://example.com/media/captcha/67842gh187612ngf8s.png'}
*/
class Index implements HttpPostActionInterface
class Index extends Action implements HttpPostActionInterface
{
/**
* @var CaptchaHelper
Expand Down Expand Up @@ -46,19 +48,22 @@ class Index implements HttpPostActionInterface
private $jsonResultFactory;

/**
* @param Context $context
* @param RequestInterface $request
* @param JsonResultFactory $jsonFactory
* @param CaptchaHelper $captchaHelper
* @param LayoutInterface $layout
* @param JsonSerializer $serializer
*/
public function __construct(
Context $context,
RequestInterface $request,
JsonResultFactory $jsonFactory,
CaptchaHelper $captchaHelper,
LayoutInterface $layout,
JsonSerializer $serializer
) {
parent::__construct($context);
$this->request = $request;
$this->jsonResultFactory = $jsonFactory;
$this->captchaHelper = $captchaHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Captcha\Controller\Refresh\Index;
use Magento\Captcha\Helper\Data as CaptchaHelper;
use Magento\Captcha\Model\CaptchaInterface;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Controller\Result\Json as ResultJson;
use Magento\Framework\Controller\Result\JsonFactory as ResultJsonFactory;
Expand Down Expand Up @@ -45,6 +46,9 @@ class IndexTest extends TestCase
/** @var MockObject|JsonSerializer */
private $jsonSerializerMock;

/** @var MockObject|Context */
private $contextMock;

/** @var Index */
private $refreshAction;

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

$this->contextMock = $this->createMock(Context::class);

$this->blockMock->method('setIsAjax')
->willReturnSelf();

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

$this->refreshAction = new Index(
$this->contextMock,
$this->requestMock,
$this->jsonResultFactoryMock,
$this->captchaHelperMock,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Catalog\Model\Product\Webapi\Rest;

use Magento\Framework\Webapi\Rest\Request\DeserializerInterface;
use Magento\Framework\Webapi\Rest\Request\DeserializerFactory;
use Magento\Framework\Webapi\Rest\Request;

/**
* Class RequestTypeBasedDeserializer
*
* Used for deserialization rest request body.
* Runs appropriate deserialization class object based on request body content type.
*/
class RequestTypeBasedDeserializer implements DeserializerInterface
{
/**
* @var Request
*/
private $request;

/**
* @var DeserializerFactory
*/
private $deserializeFactory;

/**
* RequestTypeBasedDeserializer constructor.
*
* @param DeserializerFactory $deserializeFactory
* @param Request $request
*/
public function __construct(
DeserializerFactory $deserializeFactory,
Request $request
) {
$this->deserializeFactory = $deserializeFactory;
$this->request = $request;
}

/**
* @inheritdoc
*
* Parse request body into array of params with identifying request body content type
* to use appropriate instance of deserializer class
*
* @param string $body Posted content from request
* @return array|null Return NULL if content is invalid
* @throws \Magento\Framework\Exception\InputException
* @throws \Magento\Framework\Webapi\Exception
*/
public function deserialize($body)
{
$deserializer = $this->deserializeFactory->get($this->request->getContentType());
return $deserializer->deserialize($body);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
</annotations>
<arguments>
<argument name="firstStoreViewName" type="string"/>
<argument name="secondStoreViewName" type="string"/>
</arguments>

<click selector="{{AdminProductFormNewAttributeSection.addValue}}" stepKey="addValue" after="selectAttributeType"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<arguments>
<argument name="category"/>
<argument name="simpleProduct"/>
<argument name="charLimit"/>
</arguments>

<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
Expand Down
Loading

0 comments on commit 2fe9174

Please sign in to comment.