Skip to content

Commit e697bc4

Browse files
author
Stanislav Idolov
authored
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #16080: Adding support for variadic arguments fro method in generated proxy c� (by @vgelani) - #16065: [Backport 2.2] Added unit test for captcha string resolver (by @rogyar) - #16052: Disabling sorting in glob and scandir functions for better performance (by @lfluvisotto) - #16053: Improve retrieval of first array element (by @thomas-blackbird) - #16010: Small refactoring to better code readability (by @likemusic) - #15811: [Correct code formatting] (by @hitesh-wagento) - #15902: Complete the fix for cache issue due to the currencies with no symbol (by @dmytro-ch) - #16012: Fix issue #15832 (by @Karlasa) - #15913: [Backport] Fixes in catalog component blocks [2.3-develop] (by @chirag-wagento) - #15647: [Backport] Fixes in widget component (by @mhauri) - #15893: Solve overlapping Issue on every Home page & category page of Hot Sel� (by @chirag-wagento) Fixed GitHub Issues: - #15832: No button-primary__font-weight (reported by @DanielRuf) has been fixed in #16012 by @Karlasa in 2.2-develop branch Related commits: 1. ab643ce 2. dd007e3 - #15213: Alignment & overlapping Issue on every Home page & category page of Hot Seller section (reported by @cnviradiya) has been fixed in #15893 by @chirag-wagento in 2.2-develop branch Related commits: 1. 51d0991
2 parents 695aaf8 + 15deefa commit e697bc4

File tree

39 files changed

+571
-441
lines changed

39 files changed

+571
-441
lines changed

app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,18 @@ protected function _toHtml()
124124
if (!$this->_depends) {
125125
return '';
126126
}
127-
return '<script>
128-
require(["mage/adminhtml/form"], function(){
129-
new FormElementDependenceController(' .
130-
$this->_getDependsJson() .
131-
($this->_configOptions ? ', ' .
132-
$this->_jsonEncoder->encode(
133-
$this->_configOptions
134-
) : '') . '); });</script>';
127+
128+
$params = $this->_getDependsJson();
129+
130+
if ($this->_configOptions) {
131+
$params .= ', ' . $this->_jsonEncoder->encode($this->_configOptions);
132+
}
133+
134+
return "<script>
135+
require(['mage/adminhtml/form'], function(){
136+
new FormElementDependenceController({$params});
137+
});
138+
</script>";
135139
}
136140

137141
/**
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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\Captcha\Test\Unit\Observer;
9+
10+
use Magento\Captcha\Helper\Data as CaptchaDataHelper;
11+
use Magento\Captcha\Observer\CaptchaStringResolver;
12+
use Magento\Framework\App\Request\Http as HttpRequest;
13+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
14+
15+
class CaptchaStringResolverTest extends \PHPUnit\Framework\TestCase
16+
{
17+
/**
18+
* @var ObjectManager
19+
*/
20+
private $objectManagerHelper;
21+
22+
/**
23+
* @var CaptchaStringResolver
24+
*/
25+
private $captchaStringResolver;
26+
27+
/**
28+
* @var HttpRequest|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $requestMock;
31+
32+
protected function setUp()
33+
{
34+
$this->objectManagerHelper = new ObjectManager($this);
35+
$this->requestMock = $this->createMock(HttpRequest::class);
36+
$this->captchaStringResolver = $this->objectManagerHelper->getObject(CaptchaStringResolver::class);
37+
}
38+
39+
public function testResolveWithFormIdSet()
40+
{
41+
$formId = 'contact_us';
42+
$captchaValue = 'some-value';
43+
44+
$this->requestMock->expects($this->once())
45+
->method('getPost')
46+
->with(CaptchaDataHelper::INPUT_NAME_FIELD_VALUE)
47+
->willReturn([$formId => $captchaValue]);
48+
49+
self::assertEquals(
50+
$this->captchaStringResolver->resolve($this->requestMock, $formId),
51+
$captchaValue
52+
);
53+
}
54+
55+
public function testResolveWithNoFormIdInRequest()
56+
{
57+
$formId = 'contact_us';
58+
59+
$this->requestMock->expects($this->once())
60+
->method('getPost')
61+
->with(CaptchaDataHelper::INPUT_NAME_FIELD_VALUE)
62+
->willReturn([]);
63+
64+
self::assertEquals(
65+
$this->captchaStringResolver->resolve($this->requestMock, $formId),
66+
''
67+
);
68+
}
69+
}

app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public function getBreadcrumbsJavascript($path, $javascriptVarName)
325325
*
326326
* @param Node|array $node
327327
* @param int $level
328-
* @return string
328+
* @return array
329329
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
330330
* @SuppressWarnings(PHPMD.NPathComplexity)
331331
*/

app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function (node, e) {
144144
*
145145
* @param \Magento\Framework\Data\Tree\Node|array $node
146146
* @param int $level
147-
* @return string
147+
* @return array
148148
*/
149149
protected function _getNodeJson($node, $level = 0)
150150
{

app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Element extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Eleme
2121
/**
2222
* Retrieve data object related with form
2323
*
24-
* @return \Magento\Catalog\Model\Product || \Magento\Catalog\Model\Category
24+
* @return \Magento\Catalog\Model\Product|\Magento\Catalog\Model\Category
2525
*/
2626
public function getDataObject()
2727
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Grid.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ protected function _prepareColumns()
101101
'type' => 'options',
102102
'options' => ['1' => __('Yes'), '0' => __('No')],
103103
'align' => 'center'
104-
],
105-
'is_user_defined'
104+
]
106105
);
107106

108107
$this->_eventManager->dispatch('product_attribute_grid_build', ['grid' => $this]);

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getSelectorOptions()
8181
*
8282
* @param string $labelPart
8383
* @param int $templateId
84-
* @return \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection
84+
* @return array
8585
*/
8686
public function getSuggestedAttributes($labelPart, $templateId = null)
8787
{

app/code/Magento/Catalog/Block/Adminhtml/Rss/Grid/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function isRssAllowed()
6969
}
7070

7171
/**
72-
* @return string
72+
* @return array
7373
*/
7474
protected function getLinkParams()
7575
{

app/code/Magento/Catalog/Block/Category/Plugin/PriceBoxTags.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function afterGetCacheKey(PriceBox $subject, $result)
7171
'-',
7272
[
7373
$result,
74-
$this->priceCurrency->getCurrencySymbol(),
74+
$this->priceCurrency->getCurrency()->getCode(),
7575
$this->dateTime->scopeDate($this->scopeResolver->getScope()->getId())->format('Ymd'),
7676
$this->scopeResolver->getScope()->getId(),
7777
$this->customerSession->getCustomerGroupId(),

app/code/Magento/Catalog/Block/Category/Rss/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getLabel()
6262
}
6363

6464
/**
65-
* @return string
65+
* @return array
6666
*/
6767
protected function getLinkParams()
6868
{

app/code/Magento/Catalog/Block/Product/AbstractProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function getAddToCompareUrl()
195195
* Gets minimal sales quantity
196196
*
197197
* @param \Magento\Catalog\Model\Product $product
198-
* @return int|null
198+
* @return float|null
199199
*/
200200
public function getMinimalQty($product)
201201
{

app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function getPrice($price, $includingTax = null)
178178
* Returns price converted to current currency rate
179179
*
180180
* @param float $price
181-
* @return float
181+
* @return float|string
182182
*/
183183
public function getCurrencyPrice($price)
184184
{

app/code/Magento/Catalog/Block/Rss/Product/Special.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected function _construct()
107107
}
108108

109109
/**
110-
* @return string
110+
* @return array
111111
*/
112112
public function getRssData()
113113
{

app/code/Magento/Catalog/Test/Unit/Block/Category/Plugin/PriceBoxTagsTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class PriceBoxTagsTest extends \PHPUnit\Framework\TestCase
1616
*/
1717
private $priceCurrencyInterface;
1818

19+
/**
20+
* @var \Magento\Directory\Model\Currency | \PHPUnit_Framework_MockObject_MockObject
21+
*/
22+
private $currency;
23+
1924
/**
2025
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface | \PHPUnit_Framework_MockObject_MockObject
2126
*/
@@ -46,6 +51,9 @@ protected function setUp()
4651
$this->priceCurrencyInterface = $this->getMockBuilder(
4752
\Magento\Framework\Pricing\PriceCurrencyInterface::class
4853
)->getMock();
54+
$this->currency = $this->getMockBuilder(\Magento\Directory\Model\Currency::class)
55+
->disableOriginalConstructor()
56+
->getMock();
4957
$this->timezoneInterface = $this->getMockBuilder(
5058
\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class
5159
)->getMock();
@@ -82,7 +90,7 @@ protected function setUp()
8290
public function testAfterGetCacheKey()
8391
{
8492
$date = date('Ymd');
85-
$currencySymbol = '$';
93+
$currencyCode = 'USD';
8694
$result = 'result_string';
8795
$billingAddress = ['billing_address'];
8896
$shippingAddress = ['shipping_address'];
@@ -95,7 +103,7 @@ public function testAfterGetCacheKey()
95103
'-',
96104
[
97105
$result,
98-
$currencySymbol,
106+
$currencyCode,
99107
$date,
100108
$scopeId,
101109
$customerGroupId,
@@ -104,7 +112,8 @@ public function testAfterGetCacheKey()
104112
);
105113
$priceBox = $this->getMockBuilder(\Magento\Framework\Pricing\Render\PriceBox::class)
106114
->disableOriginalConstructor()->getMock();
107-
$this->priceCurrencyInterface->expects($this->once())->method('getCurrencySymbol')->willReturn($currencySymbol);
115+
$this->priceCurrencyInterface->expects($this->once())->method('getCurrency')->willReturn($this->currency);
116+
$this->currency->expects($this->once())->method('getCode')->willReturn($currencyCode);
108117
$scope = $this->getMockBuilder(\Magento\Framework\App\ScopeInterface::class)->getMock();
109118
$this->scopeResolverInterface->expects($this->any())->method('getScope')->willReturn($scope);
110119
$scope->expects($this->any())->method('getId')->willReturn($scopeId);

app/code/Magento/Rule/Model/Action/AbstractAction.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ public function __construct(
4949

5050
$this->loadAttributeOptions()->loadOperatorOptions()->loadValueOptions();
5151

52-
foreach (array_keys($this->getAttributeOption()) as $attr) {
53-
$this->setAttribute($attr);
54-
break;
52+
$attributes = $this->getAttributeOption();
53+
if ($attributes) {
54+
reset($attributes);
55+
$this->setAttribute(key($attributes));
5556
}
56-
foreach (array_keys($this->getOperatorOption()) as $operator) {
57-
$this->setOperator($operator);
58-
break;
57+
58+
$operators = $this->getOperatorOption();
59+
if ($operators) {
60+
reset($operators);
61+
$this->setOperator(key($operators));
5962
}
6063
}
6164

app/code/Magento/Rule/Model/Condition/Combine.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ public function __construct(Context $context, array $data = [])
4646
$this->loadAggregatorOptions();
4747
$options = $this->getAggregatorOptions();
4848
if ($options) {
49-
foreach (array_keys($options) as $aggregator) {
50-
$this->setAggregator($aggregator);
51-
break;
52-
}
49+
reset($options);
50+
$this->setAggregator(key($options));
5351
}
5452
}
5553

@@ -90,9 +88,10 @@ public function getAggregatorName()
9088
public function getAggregatorElement()
9189
{
9290
if ($this->getAggregator() === null) {
93-
foreach (array_keys($this->getAggregatorOption()) as $key) {
94-
$this->setAggregator($key);
95-
break;
91+
$options = $this->getAggregatorOption();
92+
if ($options) {
93+
reset($options);
94+
$this->setAggregator(key($options));
9695
}
9796
}
9897
return $this->getForm()->addField(

app/code/Magento/Widget/Model/Widget/Instance.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* @method int getThemeId()
2323
*
2424
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
25+
* @SuppressWarnings(PHPMD.TooManyFields)
2526
* @since 100.0.2
2627
*/
2728
class Instance extends \Magento\Framework\Model\AbstractModel
@@ -96,6 +97,16 @@ class Instance extends \Magento\Framework\Model\AbstractModel
9697
*/
9798
protected $_relatedCacheTypes;
9899

100+
/**
101+
* @var \Magento\Catalog\Model\Product\Type
102+
*/
103+
protected $_productType;
104+
105+
/**
106+
* @var \Magento\Widget\Model\Config\Reader
107+
*/
108+
protected $_reader;
109+
99110
/**
100111
* @var \Magento\Framework\Escaper
101112
*/

app/code/Magento/Widget/Test/Unit/Model/_files/widget.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</parameter>
4242
<parameter name="id_path" xsi:type="block" visible="true" required="true" sort_order="10">
4343
<label translate="true">Product</label>
44-
<block class="Magento\Backend\Block\Catalog\Product\Widget\Chooser">
44+
<block class="Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser">
4545
<data>
4646
<item name="button" xsi:type="array">
4747
<item name="open" xsi:type="string" translate="true">Select Product...</item>

app/code/Magento/Widget/Test/Unit/Model/_files/widget_config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
'type' => 'label',
4949
'@' => ['type' => 'complex'],
5050
'helper_block' => [
51-
'type' => \Magento\Backend\Block\Catalog\Product\Widget\Chooser::class,
51+
'type' => \Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser::class,
5252
'data' => ['button' => ['open' => 'Select Product...']],
5353
],
5454
'visible' => '1',

app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_authentication.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
padding: @block-auth__dropdown__padding;
2626
}
2727
}
28+
2829
.authentication-wrapper {
2930
float: right;
3031
margin-top: -1.5*@indent__xl;

app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_payment-options.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@
198198
.payment-option-title {
199199
.lib-css(padding-left, @checkout-payment-option-content__padding__xl);
200200
}
201+
201202
.payment-option-content {
202203
.payment-option-inner {
203204
+ .actions-toolbar {

app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_shipping.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
}
189189
}
190190
}
191+
191192
.row-error {
192193
td {
193194
border-top: none;
@@ -285,6 +286,7 @@
285286
.lib-css(max-width, @checkout-shipping-address__max-width);
286287
}
287288
}
289+
288290
.table-checkout-shipping-method {
289291
width: auto;
290292
}
@@ -324,6 +326,7 @@
324326
}
325327
}
326328
}
329+
327330
.table-checkout-shipping-method {
328331
min-width: 500px;
329332
}

app/design/frontend/Magento/blank/Magento_GiftRegistry/web/css/source/_module.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
.actions-toolbar:not(:last-child) {
1616
margin-bottom: @indent__xl;
1717
}
18+
1819
.fieldset {
1920
.nested {
2021
.field:not(.choice) {

0 commit comments

Comments
 (0)