Skip to content

Commit 6b34507

Browse files
authored
Merge pull request #8616 from magento-gl/bt_comm_pr_247beta3
[Bluetooth] Community Pull Requests delivery
2 parents 25ebfb8 + 2b11c3d commit 6b34507

File tree

32 files changed

+296
-274
lines changed

32 files changed

+296
-274
lines changed

app/code/Magento/Backend/Model/Menu.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function add(Item $item, $parentId = null, $index = null)
8686
$index = (int) $index;
8787
if (!isset($this[$index])) {
8888
$this->offsetSet($index, $item);
89-
$this->_logger->info(
89+
$this->_logger->debug(
9090
sprintf('Add of item with id %s was processed', $item->getId())
9191
);
9292
} else {
@@ -151,7 +151,7 @@ public function remove($itemId)
151151
if ($item->getId() == $itemId) {
152152
unset($this[$key]);
153153
$result = true;
154-
$this->_logger->info(
154+
$this->_logger->debug(
155155
sprintf('Remove on item with id %s was processed', $item->getId())
156156
);
157157
break;

app/code/Magento/Backend/Model/Menu/Director/Director.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
namespace Magento\Backend\Model\Menu\Director;
88

9+
use Magento\Backend\Model\Menu\Builder;
10+
use Magento\Backend\Model\Menu\Builder\AbstractCommand;
11+
use Psr\Log\LoggerInterface;
12+
913
/**
1014
* @api
1115
* @since 100.0.2
@@ -23,14 +27,14 @@ class Director extends \Magento\Backend\Model\Menu\AbstractDirector
2327
* Get command object
2428
*
2529
* @param array $data command params
26-
* @param \Psr\Log\LoggerInterface $logger
27-
* @return \Magento\Backend\Model\Menu\Builder\AbstractCommand
30+
* @param LoggerInterface $logger
31+
* @return AbstractCommand
2832
*/
2933
protected function _getCommand($data, $logger)
3034
{
3135
$command = $this->_commandFactory->create($data['type'], ['data' => $data]);
3236
if (isset($this->_messagePatterns[$data['type']])) {
33-
$logger->info(
37+
$logger->debug(
3438
sprintf($this->_messagePatterns[$data['type']], $command->getId())
3539
);
3640
}
@@ -41,14 +45,14 @@ protected function _getCommand($data, $logger)
4145
* Build menu instance
4246
*
4347
* @param array $config
44-
* @param \Magento\Backend\Model\Menu\Builder $builder
45-
* @param \Psr\Log\LoggerInterface $logger
48+
* @param Builder $builder
49+
* @param LoggerInterface $logger
4650
* @return void
4751
*/
4852
public function direct(
4953
array $config,
50-
\Magento\Backend\Model\Menu\Builder $builder,
51-
\Psr\Log\LoggerInterface $logger
54+
Builder $builder,
55+
LoggerInterface $logger
5256
) {
5357
foreach ($config as $data) {
5458
$builder->processCommand($this->_getCommand($data, $logger));

app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function getValue()
140140
if (!$this->useRegularPrice) {
141141
$value = $this->discountCalculator->calculateDiscount($this->bundleProduct, $value);
142142
}
143-
$this->value = $this->priceCurrency->round($value);
143+
$this->value = $this->priceCurrency->roundPrice($value, 4);
144144
$product->setData($bundleSelectionKey, $this->value);
145145

146146
return $this->value;

app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionPriceTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ protected function setUp(): void
106106
$this->productMock->expects($this->atLeastOnce())
107107
->method('getPriceInfo')
108108
->willReturn($this->priceInfoMock);
109-
110-
$this->priceCurrencyMock = $this->getMockForAbstractClass(PriceCurrencyInterface::class);
111-
109+
110+
$this->priceCurrencyMock = $this->getMockBuilder(PriceCurrencyInterface::class)
111+
->disableOriginalConstructor()
112+
->addMethods(['roundPrice'])
113+
->getMockForAbstractClass();
114+
112115
$this->quantity = 1;
113116

114117
$this->setupSelectionPrice();
@@ -169,7 +172,7 @@ public function testGetValueTypeDynamic($useRegularPrice)
169172
}
170173

171174
$this->priceCurrencyMock->expects($this->once())
172-
->method('round')
175+
->method('roundPrice')
173176
->with($actualPrice)
174177
->willReturn($expectedPrice);
175178

@@ -234,7 +237,7 @@ public function testGetValueTypeFixedWithSelectionPriceType(bool $useRegularPric
234237
}
235238

236239
$this->priceCurrencyMock->expects($this->once())
237-
->method('round')
240+
->method('roundPrice')
238241
->with($actualPrice)
239242
->willReturn($expectedPrice);
240243

@@ -282,7 +285,7 @@ public function testGetValueTypeFixedWithoutSelectionPriceType($useRegularPrice)
282285
}
283286

284287
$this->priceCurrencyMock->expects($this->once())
285-
->method('round')
288+
->method('roundPrice')
286289
->with($actualPrice)
287290
->willReturn($expectedPrice);
288291

@@ -343,7 +346,7 @@ public function testFixedPriceWithMultipleQty($useRegularPrice)
343346
}
344347

345348
$this->priceCurrencyMock->expects($this->once())
346-
->method('round')
349+
->method('roundPrice')
347350
->with($actualPrice)
348351
->willReturn($expectedPrice);
349352

@@ -405,7 +408,7 @@ public function testGetAmount()
405408
->willReturn($price);
406409

407410
$this->priceCurrencyMock->expects($this->once())
408-
->method('round')
411+
->method('roundPrice')
409412
->with($price)
410413
->willReturn($price);
411414

app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/NewConditionHtml.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public function execute()
2929
str_replace('-', '/', $this->getRequest()->getParam('type', ''))
3030
);
3131
$objectType = $types[0];
32-
$reponseBody = '';
32+
$responseBody = '';
3333

3434
if (class_exists($objectType) && !in_array(ConditionInterface::class, class_implements($objectType))) {
35-
$this->getResponse()->setBody($reponseBody);
35+
$this->getResponse()->setBody($responseBody);
3636
return;
3737
}
3838

@@ -49,9 +49,9 @@ public function execute()
4949
if ($conditionModel instanceof AbstractCondition) {
5050
$conditionModel->setJsFormObject($this->getRequest()->getParam('form'));
5151
$conditionModel->setFormName($formNamespace);
52-
$reponseBody = $conditionModel->asHtmlRecursive();
52+
$responseBody = $conditionModel->asHtmlRecursive();
5353
}
5454

55-
$this->getResponse()->setBody($reponseBody);
55+
$this->getResponse()->setBody($responseBody);
5656
}
5757
}

app/code/Magento/CatalogWidget/view/adminhtml/templates/product/widget/conditions.phtml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,25 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/** @var \Magento\CatalogWidget\Block\Product\Widget\Conditions $block */
8-
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
7+
use Magento\CatalogWidget\Block\Product\Widget\Conditions;
8+
use Magento\Framework\View\Helper\SecureHtmlRenderer;
9+
use Magento\Framework\Escaper;
910

11+
/** @var Conditions $block */
12+
/** @var SecureHtmlRenderer $secureRenderer */
13+
/** @var Escaper $escaper */
14+
15+
// phpcs:disable Generic.Files.LineLength.TooLong
16+
?>
17+
<?php
1018
$element = $block->getElement();
11-
$fieldId = $element->getHtmlContainerId() ? ' id="' . $block->escapeHtmlAttr($element->getHtmlContainerId()) . '"' : '';
12-
$fieldClass = 'field admin__field field-' . $block->escapeHtmlAttr($element->getId()) . ' '
13-
. $block->escapeHtmlAttr($element->getCssClass());
19+
$fieldId = $element->getHtmlContainerId() ?
20+
' id="' . $escaper->escapeHtmlAttr($element->getHtmlContainerId()) . '"' : '';
21+
$fieldClass = 'field admin__field field-' . $escaper->escapeHtmlAttr((string)$element->getId()) . ' '
22+
. $escaper->escapeHtmlAttr($element->getCssClass());
1423
$fieldClass .= $element->getRequired() ? ' required' : '';
1524
$fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
16-
. $block->getUiId('form-field', $block->escapeHtmlAttr($element->getId()));
25+
. $block->getUiId('form-field', $escaper->escapeHtmlAttr((string)$element->getId()));
1726
?>
1827
<div<?= /* @noEscape */ $fieldAttributes ?>>
1928
<?= $element->getLabelHtml() ?>
@@ -31,8 +40,9 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
3140
"Magento_Rule/rules",
3241
"prototype"
3342
], function(VarienRulesForm){
34-
window.{$block->escapeJs($block->getHtmlId())} = new VarienRulesForm('{$block->escapeJs($block->getHtmlId())}',
35-
'{$block->escapeUrl($block->getNewChildUrl())}');
43+
window.{$escaper->escapeJs($block->getHtmlId())} = new VarienRulesForm(
44+
'{$escaper->escapeJs($block->getHtmlId())}',
45+
'{$escaper->escapeUrl($block->getNewChildUrl())}');
3646
});
3747
script;
3848
?>

app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
use Magento\Catalog\Block\Product\ReviewRendererInterface;
8+
use Magento\Catalog\Helper\Product\Compare;
9+
use Magento\CatalogWidget\Block\Product\ProductsList;
710
use Magento\Framework\App\Action\Action;
11+
use Magento\Framework\Escaper;
12+
use Magento\Wishlist\Helper\Data;
813

9-
/**
10-
* @var \Magento\CatalogWidget\Block\Product\ProductsList $block
11-
* @var \Magento\Framework\Escaper $escaper
12-
*/
14+
/** @var Escaper $escaper */
15+
/** @var ProductsList $block */
1316

1417
// phpcs:disable Generic.Files.LineLength.TooLong
1518
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
@@ -27,13 +30,13 @@ use Magento\Framework\App\Action\Action;
2730
$showWishlist = true;
2831
$showCompare = true;
2932
$showCart = true;
30-
$templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
33+
$templateType = ReviewRendererInterface::SHORT_VIEW;
3134
$description = false;
3235
?>
3336
<div class="block widget block-products-list <?= /* @noEscape */ $mode ?>">
3437
<?php if ($block->getTitle()): ?>
3538
<div class="block-title">
36-
<strong><?= $block->escapeHtml(__($block->getTitle())) ?></strong>
39+
<strong><?= $escaper->escapeHtml(__($block->getTitle())) ?></strong>
3740
</div>
3841
<?php endif ?>
3942
<div class="block-content">
@@ -44,15 +47,15 @@ use Magento\Framework\App\Action\Action;
4447
<?php foreach ($items as $_item): ?>
4548
<?= /* @noEscape */ ($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
4649
<div class="product-item-info">
47-
<a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo">
50+
<a href="<?= $escaper->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo">
4851
<?= $block->getImage($_item, $image)->toHtml() ?>
4952
</a>
5053
<div class="product-item-details">
5154
<strong class="product-item-name">
52-
<a title="<?= $block->escapeHtml($_item->getName()) ?>"
53-
href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>"
55+
<a title="<?= $escaper->escapeHtml($_item->getName()) ?>"
56+
href="<?= $escaper->escapeUrl($block->getProductUrl($_item)) ?>"
5457
class="product-item-link">
55-
<?= $block->escapeHtml($_item->getName()) ?>
58+
<?= $escaper->escapeHtml($_item->getName()) ?>
5659
</a>
5760
</strong>
5861
<?php if ($templateType): ?>
@@ -70,14 +73,14 @@ use Magento\Framework\App\Action\Action;
7073
<div class="actions-primary">
7174
<?php if ($_item->isSaleable()): ?>
7275
<?php $postParams = $block->getAddToCartPostParams($_item); ?>
73-
<form data-role="tocart-form" data-product-sku="<?= $block->escapeHtml($_item->getSku()) ?>" action="<?= $block->escapeUrl($postParams['action']) ?>" method="post">
74-
<input type="hidden" name="product" value="<?= $block->escapeHtmlAttr($postParams['data']['product']) ?>">
76+
<form data-role="tocart-form" data-product-sku="<?= $escaper->escapeHtml($_item->getSku()) ?>" action="<?= $escaper->escapeUrl($postParams['action']) ?>" method="post">
77+
<input type="hidden" name="product" value="<?= $escaper->escapeHtmlAttr($postParams['data']['product']) ?>">
7578
<input type="hidden" name="<?= /* @noEscape */ Action::PARAM_NAME_URL_ENCODED ?>" value="<?= /* @noEscape */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>">
7679
<?= $block->getBlockHtml('formkey') ?>
7780
<button type="submit"
78-
title="<?= $block->escapeHtml(__('Add to Cart')) ?>"
81+
title="<?= $escaper->escapeHtml(__('Add to Cart')) ?>"
7982
class="action tocart primary">
80-
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
83+
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
8184
</button>
8285
</form>
8386
<?php if ($block->getBlockHtml('formkey')): ?>
@@ -93,25 +96,25 @@ use Magento\Framework\App\Action\Action;
9396
<?php endif;?>
9497
<?php else: ?>
9598
<?php if ($_item->isAvailable()): ?>
96-
<div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div>
99+
<div class="stock available"><span><?= $escaper->escapeHtml(__('In stock')) ?></span></div>
97100
<?php else: ?>
98-
<div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div>
101+
<div class="stock unavailable"><span><?= $escaper->escapeHtml(__('Out of stock')) ?></span></div>
99102
<?php endif; ?>
100103
<?php endif; ?>
101104
</div>
102105
<?php endif; ?>
103106
<?php if ($showWishlist || $showCompare): ?>
104107
<div class="actions-secondary" data-role="add-to-links">
105-
<?php if ($this->helper(\Magento\Wishlist\Helper\Data::class)->isAllow() && $showWishlist): ?>
108+
<?php if ($this->helper(Data::class)->isAllow() && $showWishlist): ?>
106109
<a href="#"
107110
data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>">
108-
<span><?= $block->escapeHtml(__('Add to Wish List')) ?></span>
111+
<span><?= $escaper->escapeHtml(__('Add to Wish List')) ?></span>
109112
</a>
110113
<?php endif; ?>
111114
<?php if ($block->getAddToCompareUrl() && $showCompare): ?>
112-
<?php $compareHelper = $this->helper(\Magento\Catalog\Helper\Product\Compare::class);?>
115+
<?php $compareHelper = $this->helper(Compare::class);?>
113116
<a href="#" class="action tocompare" data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>">
114-
<span><?= $block->escapeHtml(__('Add to Compare')) ?></span>
117+
<span><?= $escaper->escapeHtml(__('Add to Compare')) ?></span>
115118
</a>
116119
<?php endif; ?>
117120
</div>

app/code/Magento/Customer/Model/Metadata/Form/Multiline.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function validateValue($value)
8282
public function compactValue($value)
8383
{
8484
if (is_array($value)) {
85+
ksort($value);
8586
$value = trim(implode("\n", $value));
8687
}
8788
$value = [$value];

app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/MultilineTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,28 @@ public function validateValueLengthDataProvider()
9494
]
9595
);
9696
}
97+
98+
/**
99+
* @param array $value value to pass to compactValue()
100+
* @param string $expected expected output
101+
*
102+
* @dataProvider compactValueDataProvider
103+
*/
104+
public function testCompactValue($value, $expected)
105+
{
106+
$this->assertSame($expected, $this->getClass("line")->compactValue($value));
107+
}
108+
109+
/**
110+
* @return array
111+
*/
112+
public function compactValueDataProvider()
113+
{
114+
return [
115+
[
116+
["b"=>"element1", "a"=>"element2"],
117+
["element2\nelement1"],
118+
]
119+
];
120+
}
97121
}

app/code/Magento/CustomerGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ enum CountryCodeEnum @doc(description: "The list of country codes.") {
253253
GQ @doc(description: "Equatorial Guinea")
254254
ER @doc(description: "Eritrea")
255255
EE @doc(description: "Estonia")
256+
SZ @doc(description: "Eswatini")
256257
ET @doc(description: "Ethiopia")
257258
FK @doc(description: "Falkland Islands")
258259
FO @doc(description: "Faroe Islands")
@@ -393,7 +394,6 @@ enum CountryCodeEnum @doc(description: "The list of country codes.") {
393394
SD @doc(description: "Sudan")
394395
SR @doc(description: "Suriname")
395396
SJ @doc(description: "Svalbard & Jan Mayen")
396-
SZ @doc(description: "Swaziland")
397397
SE @doc(description: "Sweden")
398398
CH @doc(description: "Switzerland")
399399
SY @doc(description: "Syria")

app/code/Magento/Dhl/Test/Unit/Model/_files/countries.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@
13131313
<currency>SZL</currency>
13141314
<weight_unit>KG</weight_unit>
13151315
<measure_unit>CM</measure_unit>
1316-
<name>Swaziland</name>
1316+
<name>Eswatini</name>
13171317
</SZ>
13181318
<TC>
13191319
<currency>USD</currency>

app/code/Magento/Dhl/etc/countries.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@
13131313
<currency>SZL</currency>
13141314
<weight_unit>KG</weight_unit>
13151315
<measure_unit>CM</measure_unit>
1316-
<name>Swaziland</name>
1316+
<name>Eswatini</name>
13171317
</SZ>
13181318
<TC>
13191319
<currency>USD</currency>

app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Name.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public function render(\Magento\Framework\DataObject $row)
2222
{
2323
/** @var \Magento\Integration\Model\Integration $row */
2424
$text = parent::render($row);
25-
if (!$this->isUrlSecure($row->getEndpoint()) || !$this->isUrlSecure($row->getIdentityLinkUrl())) {
25+
if (($row->getEndpoint() && !$this->isUrlSecure($row->getEndpoint())) ||
26+
($row->getIdentityLinkUrl() && !$this->isUrlSecure($row->getIdentityLinkUrl()))) {
2627
$text .= '<span class="security-notice"><span>' . __("Integration not secure") . '</span></span>';
2728
}
2829
return $text;

0 commit comments

Comments
 (0)