Skip to content

Commit d96e5f1

Browse files
[Magento Community Engineering] Community Contributions - 2.3-develop
- merged latest code from mainline branch
2 parents e1d3689 + abbfa03 commit d96e5f1

File tree

182 files changed

+8252
-1145
lines changed

Some content is hidden

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

182 files changed

+8252
-1145
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/Backend/view/adminhtml/templates/widget/grid.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ $numColumns = $block->getColumns() !== null ? count($block->getColumns()) : 0;
170170
<?php if ($block->getSortableUpdateCallback()) : ?>
171171
<?= $block->escapeJs($block->getJsObjectName()) ?>.sortableUpdateCallback = <?= /* @noEscape */ $block->getSortableUpdateCallback() ?>;
172172
<?php endif; ?>
173+
<?php if ($block->getFilterKeyPressCallback()) : ?>
174+
<?= $block->escapeJs($block->getJsObjectName()) ?>.filterKeyPressCallback = <?= /* @noEscape */ $block->getFilterKeyPressCallback() ?>;
175+
<?php endif; ?>
173176
<?= $block->escapeJs($block->getJsObjectName()) ?>.bindSortable();
174177
<?php if ($block->getRowInitCallback()) : ?>
175178
<?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>;

app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ $numColumns = count($block->getColumns());
272272
<?php if ($block->getCheckboxCheckCallback()) : ?>
273273
<?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>;
274274
<?php endif; ?>
275+
<?php if ($block->getFilterKeyPressCallback()) : ?>
276+
<?= $block->escapeJs($block->getJsObjectName()) ?>.filterKeyPressCallback = <?= /* @noEscape */ $block->getFilterKeyPressCallback() ?>;
277+
<?php endif; ?>
275278
<?php if ($block->getRowInitCallback()) : ?>
276279
<?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>;
277280
<?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows();

app/code/Magento/Braintree/Gateway/Validator/ErrorCodeProvider.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Braintree\Error\Validation;
1212
use Braintree\Result\Error;
1313
use Braintree\Result\Successful;
14+
use Braintree\Transaction;
1415

1516
/**
1617
* Processes errors codes from Braintree response.
@@ -38,12 +39,14 @@ public function getErrorCodes($response): array
3839
$result[] = $error->code;
3940
}
4041

41-
if (isset($response->transaction) && $response->transaction->status === 'gateway_rejected') {
42-
$result[] = $response->transaction->gatewayRejectionReason;
43-
}
42+
if (isset($response->transaction) && $response->transaction) {
43+
if ($response->transaction->status === Transaction::GATEWAY_REJECTED) {
44+
$result[] = $response->transaction->gatewayRejectionReason;
45+
}
4446

45-
if (isset($response->transaction) && $response->transaction->status === 'processor_declined') {
46-
$result[] = $response->transaction->processorResponseCode;
47+
if ($response->transaction->status === Transaction::PROCESSOR_DECLINED) {
48+
$result[] = $response->transaction->processorResponseCode;
49+
}
4750
}
4851

4952
return $result;

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
) {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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;
9+
10+
use Magento\Framework\EntityManager\HydratorInterface;
11+
12+
/**
13+
* Class is used to extract data and populate entity with data
14+
*/
15+
class Hydrator implements HydratorInterface
16+
{
17+
/**
18+
* @inheritdoc
19+
*/
20+
public function extract($entity)
21+
{
22+
return $entity->getData();
23+
}
24+
25+
/**
26+
* @inheritdoc
27+
*/
28+
public function hydrate($entity, array $data)
29+
{
30+
$lockedAttributes = $entity->getLockedAttributes();
31+
$entity->unlockAttributes();
32+
$entity->setData(array_merge($entity->getData(), $data));
33+
foreach ($lockedAttributes as $attribute) {
34+
$entity->lockAttribute($attribute);
35+
}
36+
37+
return $entity;
38+
}
39+
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,18 @@
191191
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/>
192192
<dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="dontSeeCategoryInTree"/>
193193
</actionGroup>
194+
<actionGroup name="AdminDeleteCategoryByName" extends="DeleteCategory">
195+
<arguments>
196+
<argument name="categoryName" type="string" defaultValue="category1"/>
197+
</arguments>
198+
<remove keyForRemoval="clickCategoryLink"/>
199+
<remove keyForRemoval="dontSeeCategoryInTree"/>
200+
<remove keyForRemoval="expandToSeeAllCategories"/>
201+
<conditionalClick selector="{{AdminCategorySidebarTreeSection.expandAll}}" dependentSelector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" visible="false" stepKey="expandCategories" after="waitForCategoryPageLoad"/>
202+
<click selector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" stepKey="clickCategory" after="expandCategories"/>
203+
<conditionalClick selector="{{AdminCategorySidebarTreeSection.expandAll}}" dependentSelector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" visible="false" stepKey="expandCategoriesToSeeAll" after="seeDeleteSuccess"/>
204+
<dontSee selector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" stepKey="dontSeeCategory" after="expandCategoriesToSeeAll"/>
205+
</actionGroup>
194206

195207
<!-- Actions to fill out a new category from the product page-->
196208
<!-- The action assumes that you are already on an admin product configuration page -->

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>

0 commit comments

Comments
 (0)