Skip to content

Commit aeac4b5

Browse files
author
Oleksandr Iegorov
committed
Merge branch '2.4-develop' of https://github.com/magento/magento2ce into MC-22998
2 parents b34022d + b91e97f commit aeac4b5

File tree

75 files changed

+1487
-646
lines changed

Some content is hidden

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

75 files changed

+1487
-646
lines changed

app/code/Magento/Backend/Block/System/Account/Edit/Form.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(
6868
}
6969

7070
/**
71-
* {@inheritdoc}
71+
* @inheritdoc
7272
*/
7373
protected function _prepareForm()
7474
{
@@ -114,7 +114,7 @@ protected function _prepareForm()
114114
'name' => 'password',
115115
'label' => __('New Password'),
116116
'title' => __('New Password'),
117-
'class' => 'validate-admin-password admin__control-text'
117+
'class' => 'validate-admin-password'
118118
]
119119
);
120120

@@ -124,7 +124,7 @@ protected function _prepareForm()
124124
[
125125
'name' => 'password_confirmation',
126126
'label' => __('Password Confirmation'),
127-
'class' => 'validate-cpassword admin__control-text'
127+
'class' => 'validate-cpassword'
128128
]
129129
);
130130

@@ -152,7 +152,7 @@ protected function _prepareForm()
152152
'label' => __('Your Password'),
153153
'id' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD,
154154
'title' => __('Your Password'),
155-
'class' => 'validate-current-password required-entry admin__control-text',
155+
'class' => 'validate-current-password required-entry',
156156
'required' => true
157157
]
158158
);
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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\Backend\Test\Unit\Helper;
9+
10+
use Magento\Backend\Helper\Js;
11+
use PHPUnit\Framework\TestCase;
12+
13+
/**
14+
* Class JsTest
15+
*
16+
* Testing decoding serialized grid data
17+
*/
18+
class JsTest extends TestCase
19+
{
20+
/**
21+
* @var Js
22+
*/
23+
private $helper;
24+
25+
/**
26+
* Set Up
27+
*/
28+
protected function setUp()
29+
{
30+
$this->helper = new Js();
31+
}
32+
33+
/**
34+
* Test decoding the serialized input
35+
*
36+
* @dataProvider getEncodedDataProvider
37+
*
38+
* @param string $encoded
39+
* @param array $expected
40+
*/
41+
public function testDecodeGridSerializedInput(string $encoded, array $expected)
42+
{
43+
$this->assertEquals($expected, $this->helper->decodeGridSerializedInput($encoded));
44+
}
45+
46+
/**
47+
* Get serialized grid input
48+
*
49+
* @return array
50+
*/
51+
public function getEncodedDataProvider(): array
52+
{
53+
return [
54+
'Decoding empty serialized string' => [
55+
'',
56+
[]
57+
],
58+
'Decoding a simplified serialized string' => [
59+
'1&2&3&4',
60+
[1, 2, 3, 4]
61+
],
62+
'Decoding encoded serialized string' => [
63+
'2=dGVzdC1zdHJpbmc=',
64+
[
65+
2 => [
66+
'test-string' => ''
67+
]
68+
]
69+
],
70+
'Decoding multiple encoded serialized strings' => [
71+
'2=dGVzdC1zdHJpbmc=&3=bmV3LXN0cmluZw==',
72+
[
73+
2 => [
74+
'test-string' => ''
75+
],
76+
3 => [
77+
'new-string' => ''
78+
]
79+
]
80+
]
81+
];
82+
}
83+
}

app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Price.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Registry;
1111
use Magento\Store\Model\ScopeInterface;
1212

13+
/**
14+
* Data provider for price filter in layered navigation
15+
*/
1316
class Price
1417
{
1518
/**
@@ -103,6 +106,8 @@ public function __construct(
103106
}
104107

105108
/**
109+
* Getter for interval
110+
*
106111
* @return array
107112
*/
108113
public function getInterval()
@@ -111,6 +116,8 @@ public function getInterval()
111116
}
112117

113118
/**
119+
* Setter for interval
120+
*
114121
* @param array $interval
115122
* @return void
116123
*/
@@ -120,6 +127,10 @@ public function setInterval($interval)
120127
}
121128

122129
/**
130+
* Retrieves price layered navigation modes
131+
*
132+
* @see RANGE_CALCULATION_AUTO
133+
*
123134
* @return mixed
124135
*/
125136
public function getRangeCalculationValue()
@@ -131,6 +142,8 @@ public function getRangeCalculationValue()
131142
}
132143

133144
/**
145+
* Retrieves range step
146+
*
134147
* @return mixed
135148
*/
136149
public function getRangeStepValue()
@@ -142,6 +155,8 @@ public function getRangeStepValue()
142155
}
143156

144157
/**
158+
* Retrieves one price interval
159+
*
145160
* @return mixed
146161
*/
147162
public function getOnePriceIntervalValue()
@@ -179,6 +194,8 @@ public function getRangeMaxIntervalsValue()
179194
}
180195

181196
/**
197+
* Retrieves Catalog Layer object
198+
*
182199
* @return Layer
183200
*/
184201
public function getLayer()
@@ -276,6 +293,8 @@ public function getMaxPrice()
276293
}
277294

278295
/**
296+
* Retrieve list of prior filters
297+
*
279298
* @param string $filterParams
280299
* @return array
281300
*/
@@ -310,7 +329,7 @@ public function validateFilter($filter)
310329
return false;
311330
}
312331
foreach ($filter as $v) {
313-
if ($v !== '' && $v !== '0' && (double)$v <= 0 || is_infinite((double)$v)) {
332+
if ($v !== '' && $v !== '0' && (!is_numeric($v) || (double)$v <= 0 || is_infinite((double)$v))) {
314333
return false;
315334
}
316335
}
@@ -339,6 +358,8 @@ public function getResetValue()
339358
}
340359

341360
/**
361+
* Getter for prior intervals
362+
*
342363
* @return array
343364
*/
344365
public function getPriorIntervals()
@@ -347,6 +368,8 @@ public function getPriorIntervals()
347368
}
348369

349370
/**
371+
* Setter for prior intervals
372+
*
350373
* @param array $priorInterval
351374
* @return void
352375
*/
@@ -356,6 +379,8 @@ public function setPriorIntervals($priorInterval)
356379
}
357380

358381
/**
382+
* Get Resource model for price filter
383+
*
359384
* @return \Magento\Catalog\Model\ResourceModel\Layer\Filter\Price
360385
*/
361386
public function getResource()
@@ -364,6 +389,8 @@ public function getResource()
364389
}
365390

366391
/**
392+
* Retrieves additional request data
393+
*
367394
* @return string
368395
*/
369396
public function getAdditionalRequestData()

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
<createData entity="SimpleSubCategory" stepKey="categoryEntity"/>
2929
</before>
3030
<after>
31+
<actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct">
32+
<argument name="sku" value="{{updateVirtualProductRegularPrice5OutOfStock.sku}}"/>
33+
</actionGroup>
3134
<deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/>
3235
<deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/>
3336
<actionGroup ref="logout" stepKey="logout"/>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
<createData entity="SimpleSubCategory" stepKey="categoryEntity"/>
2929
</before>
3030
<after>
31+
<actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct">
32+
<argument name="sku" value="{{updateVirtualProductRegularPrice5OutOfStock.sku}}"/>
33+
</actionGroup>
3134
<deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/>
3235
<deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/>
3336
<actionGroup ref="logout" stepKey="logout"/>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
</createData>
2828
</before>
2929
<after>
30+
<actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct">
31+
<argument name="sku" value="{{updateVirtualProductRegularPrice99OutOfStock.sku}}"/>
32+
</actionGroup>
3033
<deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/>
3134
<actionGroup ref="logout" stepKey="logout"/>
3235
</after>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
<createData entity="SimpleSubCategory" stepKey="categoryEntity"/>
2929
</before>
3030
<after>
31+
<actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct">
32+
<argument name="sku" value="{{updateVirtualProductSpecialPrice.sku}}"/>
33+
</actionGroup>
3134
<deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/>
3235
<deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/>
3336
<actionGroup ref="logout" stepKey="logout"/>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
<createData entity="SimpleSubCategory" stepKey="categoryEntity"/>
2929
</before>
3030
<after>
31+
<actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct">
32+
<argument name="sku" value="{{updateVirtualProductSpecialPriceOutOfStock.sku}}"/>
33+
</actionGroup>
3134
<deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/>
3235
<deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/>
3336
<actionGroup ref="logout" stepKey="logout"/>

app/code/Magento/Catalog/Test/Unit/Model/Layer/Filter/DataProvider/PriceTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ public function validateFilterDataProvider()
178178
['filter' => '0', 'result' => false],
179179
['filter' => 0, 'result' => false],
180180
['filter' => '100500INF', 'result' => false],
181+
['filter' => '-10\'[0]', 'result' => false],
181182
];
182183
}
183184

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ use Magento\Framework\App\Action\Action;
1313
* Product list template
1414
*
1515
* @var $block \Magento\Catalog\Block\Product\ListProduct
16+
* @var \Magento\Framework\Escaper $escaper
1617
*/
1718
?>
1819
<?php
1920
$_productCollection = $block->getLoadedProductCollection();
21+
/** @var \Magento\Catalog\Helper\Output $_helper */
2022
$_helper = $this->helper(Magento\Catalog\Helper\Output::class);
2123
?>
2224
<?php if (!$_productCollection->count()) :?>
23-
<div class="message info empty"><div><?= $block->escapeHtml(__('We can\'t find products matching the selection.')) ?></div></div>
25+
<div class="message info empty"><div><?= $escaper->escapeHtml(__('We can\'t find products matching the selection.')) ?></div></div>
2426
<?php else :?>
2527
<?= $block->getToolbarHtml() ?>
2628
<?= $block->getAdditionalHtml() ?>
@@ -55,7 +57,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
5557
}
5658
?>
5759
<?php // Product Image ?>
58-
<a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>"
60+
<a href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
5961
class="product photo product-item-photo"
6062
tabindex="-1">
6163
<?= $productImage->toHtml() ?>
@@ -66,7 +68,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
6668
?>
6769
<strong class="product name product-item-name">
6870
<a class="product-item-link"
69-
href="<?= $block->escapeUrl($_product->getProductUrl()) ?>">
71+
href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>">
7072
<?= /* @noEscape */ $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
7173
</a>
7274
</strong>
@@ -77,13 +79,13 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
7779
<?php endif; ?>
7880

7981
<div class="product-item-inner">
80-
<div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $block->escapeHtmlAttr($position) : '' ?>>
81-
<div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $block->escapeHtmlAttr($position) : '' ?>>
82+
<div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $escaper->escapeHtmlAttr($position) : '' ?>>
83+
<div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $escaper->escapeHtmlAttr($position) : '' ?>>
8284
<?php if ($_product->isSaleable()) :?>
8385
<?php $postParams = $block->getAddToCartPostParams($_product); ?>
8486
<form data-role="tocart-form"
85-
data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>"
86-
action="<?= $block->escapeUrl($postParams['action']) ?>"
87+
data-product-sku="<?= $escaper->escapeHtml($_product->getSku()) ?>"
88+
action="<?= $escaper->escapeUrl($postParams['action']) ?>"
8789
method="post">
8890
<input type="hidden"
8991
name="product"
@@ -92,20 +94,20 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
9294
value="<?= /* @noEscape */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>">
9395
<?= $block->getBlockHtml('formkey') ?>
9496
<button type="submit"
95-
title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"
97+
title="<?= $escaper->escapeHtmlAttr(__('Add to Cart')) ?>"
9698
class="action tocart primary">
97-
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
99+
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
98100
</button>
99101
</form>
100102
<?php else :?>
101103
<?php if ($_product->isAvailable()) :?>
102-
<div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div>
104+
<div class="stock available"><span><?= $escaper->escapeHtml(__('In stock')) ?></span></div>
103105
<?php else :?>
104-
<div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div>
106+
<div class="stock unavailable"><span><?= $escaper->escapeHtml(__('Out of stock')) ?></span></div>
105107
<?php endif; ?>
106108
<?php endif; ?>
107109
</div>
108-
<div data-role="add-to-links" class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $block->escapeHtmlAttr($position) : '' ?>>
110+
<div data-role="add-to-links" class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $escaper->escapeHtmlAttr($position) : '' ?>>
109111
<?php if ($addToBlock = $block->getChildBlock('addto')) :?>
110112
<?= $addToBlock->setProduct($_product)->getChildHtml() ?>
111113
<?php endif; ?>
@@ -114,9 +116,9 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
114116
<?php if ($showDescription) :?>
115117
<div class="product description product-item-description">
116118
<?= /* @noEscape */ $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
117-
<a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>"
119+
<a href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
118120
title="<?= /* @noEscape */ $_productNameStripped ?>"
119-
class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a>
121+
class="action more"><?= $escaper->escapeHtml(__('Learn More')) ?></a>
120122
</div>
121123
<?php endif; ?>
122124
</div>
@@ -132,7 +134,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
132134
{
133135
"[data-role=tocart-form], .form.map.checkout": {
134136
"catalogAddToCart": {
135-
"product_sku": "<?= $block->escapeJs($_product->getSku()) ?>"
137+
"product_sku": "<?= $escaper->escapeJs($_product->getSku()) ?>"
136138
}
137139
}
138140
}

0 commit comments

Comments
 (0)