Skip to content

Commit ad72316

Browse files
committed
Merge remote-tracking branch 'epam/2.3-develop' into EPAM-PR-84
2 parents 6015ff0 + abbfa03 commit ad72316

File tree

86 files changed

+3978
-718
lines changed

Some content is hidden

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

86 files changed

+3978
-718
lines changed

app/code/Magento/AuthorizenetAcceptjs/Test/Unit/Gateway/ConfigTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public function testGetSolutionIdSandbox($environment, $expectedSolution)
8181
$this->assertEquals($expectedSolution, $this->model->getSolutionId(123));
8282
}
8383

84+
/**
85+
* @return array
86+
*/
8487
public function configMapProvider()
8588
{
8689
return [
@@ -97,6 +100,10 @@ public function configMapProvider()
97100
['getTransactionInfoSyncKeys', 'transactionSyncKeys', 'a,b,c', ['a', 'b', 'c']],
98101
];
99102
}
103+
104+
/**
105+
* @return array
106+
*/
100107
public function environmentUrlProvider()
101108
{
102109
return [
@@ -105,6 +112,9 @@ public function environmentUrlProvider()
105112
];
106113
}
107114

115+
/**
116+
* @return array
117+
*/
108118
public function environmentSolutionProvider()
109119
{
110120
return [

app/code/Magento/AuthorizenetAcceptjs/Test/Unit/Gateway/Request/AddressDataBuilderTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,22 @@ public function testBuildWithBothAddresses()
108108
$this->assertEquals('abc', $result['transactionRequest']['customerIP']);
109109
}
110110

111+
/**
112+
* @param $responseData
113+
* @param $addressPrefix
114+
*/
111115
private function validateAddressData($responseData, $addressPrefix)
112116
{
113117
foreach ($this->mockAddressData as $fieldValue => $field) {
114118
$this->assertEquals($addressPrefix . $field['sampleData'], $responseData[$fieldValue]);
115119
}
116120
}
117121

122+
/**
123+
* @param $prefix
124+
*
125+
* @return \PHPUnit\Framework\MockObject\MockObject
126+
*/
118127
private function createAddressMock($prefix)
119128
{
120129
$addressAdapterMock = $this->createMock(AddressAdapterInterface::class);

app/code/Magento/AuthorizenetAcceptjs/Test/Unit/Gateway/Response/PaymentReviewStatusHandlerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public function testDoesNothingWhenPending(string $status)
112112
$this->handler->handle($subject, $response);
113113
}
114114

115+
/**
116+
* @return array
117+
*/
115118
public function pendingTransactionStatusesProvider()
116119
{
117120
return [
@@ -120,6 +123,9 @@ public function pendingTransactionStatusesProvider()
120123
];
121124
}
122125

126+
/**
127+
* @return array
128+
*/
123129
public function declinedTransactionStatusesProvider()
124130
{
125131
return [

app/code/Magento/Catalog/Helper/Output.php

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,21 @@
99

1010
use Magento\Catalog\Model\Category as ModelCategory;
1111
use Magento\Catalog\Model\Product as ModelProduct;
12+
use Magento\Eav\Model\Config;
13+
use Magento\Framework\App\Helper\AbstractHelper;
14+
use Magento\Framework\App\Helper\Context;
15+
use Magento\Framework\Escaper;
16+
use Magento\Framework\Exception\LocalizedException;
1217
use Magento\Framework\Filter\Template;
18+
use function is_object;
19+
use function method_exists;
20+
use function preg_match;
21+
use function strtolower;
1322

14-
class Output extends \Magento\Framework\App\Helper\AbstractHelper
23+
/**
24+
* Html output
25+
*/
26+
class Output extends AbstractHelper
1527
{
1628
/**
1729
* Array of existing handlers
@@ -37,12 +49,12 @@ class Output extends \Magento\Framework\App\Helper\AbstractHelper
3749
/**
3850
* Eav config
3951
*
40-
* @var \Magento\Eav\Model\Config
52+
* @var Config
4153
*/
4254
protected $_eavConfig;
4355

4456
/**
45-
* @var \Magento\Framework\Escaper
57+
* @var Escaper
4658
*/
4759
protected $_escaper;
4860

@@ -53,27 +65,32 @@ class Output extends \Magento\Framework\App\Helper\AbstractHelper
5365

5466
/**
5567
* Output constructor.
56-
* @param \Magento\Framework\App\Helper\Context $context
57-
* @param \Magento\Eav\Model\Config $eavConfig
68+
* @param Context $context
69+
* @param Config $eavConfig
5870
* @param Data $catalogData
59-
* @param \Magento\Framework\Escaper $escaper
71+
* @param Escaper $escaper
6072
* @param array $directivePatterns
73+
* @param array $handlers
6174
*/
6275
public function __construct(
63-
\Magento\Framework\App\Helper\Context $context,
64-
\Magento\Eav\Model\Config $eavConfig,
76+
Context $context,
77+
Config $eavConfig,
6578
Data $catalogData,
66-
\Magento\Framework\Escaper $escaper,
67-
$directivePatterns = []
79+
Escaper $escaper,
80+
$directivePatterns = [],
81+
array $handlers = []
6882
) {
6983
$this->_eavConfig = $eavConfig;
7084
$this->_catalogData = $catalogData;
7185
$this->_escaper = $escaper;
7286
$this->directivePatterns = $directivePatterns;
87+
$this->_handlers = $handlers;
7388
parent::__construct($context);
7489
}
7590

7691
/**
92+
* Return template processor
93+
*
7794
* @return Template
7895
*/
7996
protected function _getTemplateProcessor()
@@ -115,8 +132,7 @@ public function addHandler($method, $handler)
115132
*/
116133
public function getHandlers($method)
117134
{
118-
$method = strtolower($method);
119-
return $this->_handlers[$method] ?? [];
135+
return $this->_handlers[strtolower($method)] ?? [];
120136
}
121137

122138
/**
@@ -145,21 +161,21 @@ public function process($method, $result, $params)
145161
* @param string $attributeName
146162
* @return string
147163
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
148-
* @throws \Magento\Framework\Exception\LocalizedException
164+
* @throws LocalizedException
149165
*/
150166
public function productAttribute($product, $attributeHtml, $attributeName)
151167
{
152168
$attribute = $this->_eavConfig->getAttribute(ModelProduct::ENTITY, $attributeName);
153169
if ($attribute &&
154170
$attribute->getId() &&
155-
$attribute->getFrontendInput() != 'media_image' &&
171+
$attribute->getFrontendInput() !== 'media_image' &&
156172
(!$attribute->getIsHtmlAllowedOnFront() &&
157173
!$attribute->getIsWysiwygEnabled())
158174
) {
159-
if ($attribute->getFrontendInput() != 'price') {
175+
if ($attribute->getFrontendInput() !== 'price') {
160176
$attributeHtml = $this->_escaper->escapeHtml($attributeHtml);
161177
}
162-
if ($attribute->getFrontendInput() == 'textarea') {
178+
if ($attribute->getFrontendInput() === 'textarea') {
163179
$attributeHtml = nl2br($attributeHtml);
164180
}
165181
}
@@ -187,14 +203,14 @@ public function productAttribute($product, $attributeHtml, $attributeName)
187203
* @param string $attributeHtml
188204
* @param string $attributeName
189205
* @return string
190-
* @throws \Magento\Framework\Exception\LocalizedException
206+
* @throws LocalizedException
191207
*/
192208
public function categoryAttribute($category, $attributeHtml, $attributeName)
193209
{
194210
$attribute = $this->_eavConfig->getAttribute(ModelCategory::ENTITY, $attributeName);
195211

196212
if ($attribute &&
197-
$attribute->getFrontendInput() != 'image' &&
213+
$attribute->getFrontendInput() !== 'image' &&
198214
(!$attribute->getIsHtmlAllowedOnFront() &&
199215
!$attribute->getIsWysiwygEnabled())
200216
) {

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@
389389
<waitForPageLoad stepKey="waitForGridLoad"/>
390390
</actionGroup>
391391

392-
<!--Filter and select the the product -->
392+
<!--Filter and select the product -->
393393
<actionGroup name="filterAndSelectProduct">
394394
<annotations>
395395
<description>Goes to the Admin Products grid. Filters the Product grid by the provided Product SKU.</description>

app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ public function testIsExist($fileName, $fileMediaPath)
191191
$this->assertTrue($this->model->isExist($fileName));
192192
}
193193

194+
/**
195+
* @return array
196+
*/
194197
public function isExistProvider()
195198
{
196199
return [
@@ -213,6 +216,9 @@ public function testIsBeginsWithMediaDirectoryPath($fileName, $expected)
213216
$this->assertEquals($expected, $this->model->isBeginsWithMediaDirectoryPath($fileName));
214217
}
215218

219+
/**
220+
* @return array
221+
*/
216222
public function isBeginsWithMediaDirectoryPathProvider()
217223
{
218224
return [

app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@ public function testGetStoreSingleSiteModelIds(
486486
$this->assertEquals($websiteIDs, $this->model->getStoreIds());
487487
}
488488

489+
/**
490+
* @return array
491+
*/
489492
public function getSingleStoreIds()
490493
{
491494
return [

app/code/Magento/Catalog/Ui/Component/UrlInput/Product.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
use Magento\Framework\UrlInterface;
1212

13+
/**
14+
* Returns configuration for product Url Input type
15+
*/
1316
class Product implements \Magento\Ui\Model\UrlInput\ConfigInterface
1417
{
1518
/**
@@ -27,7 +30,7 @@ public function __construct(UrlInterface $urlBuilder)
2730
}
2831

2932
/**
30-
* {@inheritdoc}
33+
* @inheritdoc
3134
*/
3235
public function getConfig(): array
3336
{
@@ -46,6 +49,7 @@ public function getConfig(): array
4649
'template' => 'ui/grid/filters/elements/ui-select',
4750
'searchUrl' => $this->urlBuilder->getUrl('catalog/product/search'),
4851
'filterPlaceholder' => __('Product Name or SKU'),
52+
'filterRateLimitMethod' => 'notifyWhenChangesStop',
4953
'isDisplayEmptyPlaceholder' => true,
5054
'emptyOptionsHtml' => __('Start typing to find products'),
5155
'missingValuePlaceholder' => __('Product with ID: %s doesn\'t exist'),
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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\CatalogGraphQl\Plugin;
9+
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Framework\Message\MessageInterface;
12+
use Magento\Framework\View\DesignLoader as ViewDesignLoader;
13+
use Magento\Framework\Message\ManagerInterface;
14+
use Magento\Catalog\Block\Product\ImageFactory;
15+
16+
/**
17+
* Load necessary design files for GraphQL
18+
*/
19+
class DesignLoader
20+
{
21+
/**
22+
* @var DesignLoader
23+
*/
24+
private $designLoader;
25+
26+
/**
27+
* @var ManagerInterface
28+
*/
29+
private $messageManager;
30+
31+
/**
32+
* @param ViewDesignLoader $designLoader
33+
* @param ManagerInterface $messageManager
34+
*/
35+
public function __construct(
36+
ViewDesignLoader $designLoader,
37+
ManagerInterface $messageManager
38+
) {
39+
$this->designLoader = $designLoader;
40+
$this->messageManager = $messageManager;
41+
}
42+
43+
/**
44+
* Before create load the design files
45+
*
46+
* @param ImageFactory $subject
47+
* @param Product $product
48+
* @param string $imageId
49+
* @param array|null $attributes
50+
*
51+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
52+
*/
53+
public function beforeCreate(
54+
ImageFactory $subject,
55+
Product $product,
56+
string $imageId,
57+
array $attributes = null
58+
) {
59+
try {
60+
$this->designLoader->load();
61+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
62+
if ($e->getPrevious() instanceof \Magento\Framework\Config\Dom\ValidationException) {
63+
/** @var MessageInterface $message */
64+
$message = $this->messageManager
65+
->createMessage(MessageInterface::TYPE_ERROR)
66+
->setText($e->getMessage());
67+
$this->messageManager->addUniqueMessages([$message]);
68+
}
69+
}
70+
}
71+
}

app/code/Magento/CatalogGraphQl/etc/graphql/di.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,8 @@
137137
</argument>
138138
</arguments>
139139
</type>
140+
141+
<type name="Magento\Catalog\Block\Product\ImageFactory">
142+
<plugin name="designLoader" type="Magento\CatalogGraphQl\Plugin\DesignLoader" />
143+
</type>
140144
</config>

0 commit comments

Comments
 (0)