Skip to content

Commit e56640c

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Accepted Community Pull Requests: - #24150: Add .editorconfig file (by @ihor-sviziev) - #24179: Fix #22956 - make country names translatable (by @Bartlomiejsz) - #24167: getStoreValuesForForm($empty = false, $all = false) has bad logic (undefine variable) (by @edenduong) - #24170: resolve "Layered Navigation Price Step" must validate number issue24169 (by @edenduong) - #24171: Resolve undefined variable in getAvailableWidget(...) function (by @edenduong) - #24173: Resolve "Service->Oauth Settings" has no number validation issue24172 (by @edenduong) - #24177: ReadMe minor changes previous pr (by @diazwatson) - #24178: Update Magento_Amqp ReadMe (by @diazwatson) - #24165: Resolve "HTTP Strict Transport Security" has the Outdate Url issue24164 (by @edenduong) Fixed GitHub Issues: - #22956: Unable to translate checkout country names (reported by @rokslavec77) has been fixed in #24179 by @Bartlomiejsz in 2.3-develop branch Related commits: 1. b423aa0 2. 23afffb 3. 8dab512 - #24169: "Layered Navigation Price Step" must validate number (reported by @edenduong) has been fixed in #24170 by @edenduong in 2.3-develop branch Related commits: 1. a041a3e - #24172: "Service->Oauth Settings" has no number validation (reported by @edenduong) has been fixed in #24173 by @edenduong in 2.3-develop branch Related commits: 1. 0c0b470 - #24164: "HTTP Strict Transport Security" has the Outdate Url (reported by @edenduong) has been fixed in #24165 by @edenduong in 2.3-develop branch Related commits: 1. 274064c
2 parents 484cc98 + b1026ae commit e56640c

File tree

11 files changed

+86
-26
lines changed

11 files changed

+86
-26
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

app/code/Magento/AdminNotification/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ The Magento_AdminNotification module provides the ability to alert administrator
44

55
## Installation details
66

7+
The Magento_AdminNotification module creates the following tables in the database:
8+
- `adminnotification_inbox`
9+
- `admin_system_messages`
10+
711
Before disabling or uninstalling this module, note that the Magento_Indexer module depends on this module.
812

913
For information about module installation in Magento 2, see [Enable or disable modules](https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-subcommands-enable.html).
1014

15+
## Extensibility
16+
17+
Extension developers can interact with the Magento_AdminNotification module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html).
18+
19+
[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_AdminNotification module.
20+
1121
### Events
1222

1323
This module observes the following events:
1424

15-
- `controller_action_predispatch` event in `Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver`
25+
- `controller_action_predispatch` event in `Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver` file.
1626

1727
### Layouts
1828

app/code/Magento/AdvancedPricingImportExport/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22

33
The Magento_AdvancedPricingImportExport module handles the import and export of the advanced pricing.
44

5+
## Extensibility
6+
7+
Extension developers can interact with the Magento_AdvancedPricingImportExport module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html).
8+
9+
[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_AdvancedPricingImportExport module.

app/code/Magento/Amqp/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
# Amqp
1+
# Magento_Amqp module
22

3-
**Amqp** provides functionality to publish/consume messages with Amqp.
3+
Magento_Amqp module provides functionality to publish/consume messages with the Advanced Message Queuing Protocol (AMQP).
4+
5+
## Extensibility
6+
7+
Extension developers can interact with the Magento_Amqp module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html).
8+
9+
[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_Amqp module.

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@
536536
<label>Enable HTTP Strict Transport Security (HSTS)</label>
537537
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
538538
<backend_model>Magento\Config\Model\Config\Backend\Secure</backend_model>
539-
<comment><![CDATA[See <a href="https://www.owasp.org/index.php/HTTP_Strict_Transport_Security" target="_blank">HTTP Strict Transport Security</a> page for details.]]></comment>
539+
<comment><![CDATA[See <a href="https://cheatsheetseries.owasp.org/cheatsheets/HTTP_Strict_Transport_Security_Cheat_Sheet.html" target="_blank">HTTP Strict Transport Security</a> page for details.]]></comment>
540540
<depends>
541541
<field id="use_in_frontend">1</field>
542542
<field id="use_in_adminhtml">1</field>

app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@
349349
<settings>
350350
<validation>
351351
<rule name="required-entry" xsi:type="boolean">true</rule>
352+
<rule name="validate-number" xsi:type="boolean">true</rule>
352353
</validation>
353354
<additionalClasses>
354355
<class name="admin__field-small">true</class>

app/code/Magento/Integration/etc/adminhtml/system.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,50 +16,58 @@
1616
<field id="customer" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
1717
<label>Customer Token Lifetime (hours)</label>
1818
<comment>We will disable this feature if the value is empty.</comment>
19+
<validate>required-entry validate-zero-or-greater validate-number</validate>
1920
</field>
2021
<field id="admin" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
2122
<label>Admin Token Lifetime (hours)</label>
2223
<comment>We will disable this feature if the value is empty.</comment>
24+
<validate>required-entry validate-zero-or-greater validate-number</validate>
2325
</field>
2426
</group>
2527
<group id="cleanup" translate="label" type="text" sortOrder="300" showInDefault="1" showInWebsite="0" showInStore="0">
2628
<label>Cleanup Settings</label>
2729
<field id="cleanup_probability" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
2830
<label>Cleanup Probability</label>
2931
<comment>Integer. Launch cleanup in X OAuth requests. 0 (not recommended) - to disable cleanup</comment>
32+
<validate>required-entry validate-zero-or-greater validate-digits</validate>
3033
</field>
3134
<field id="expiration_period" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
3235
<label>Expiration Period</label>
3336
<comment>Cleanup entries older than X minutes.</comment>
37+
<validate>required-entry validate-zero-or-greater validate-number</validate>
3438
</field>
3539
</group>
3640
<group id="consumer" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0">
3741
<label>Consumer Settings</label>
3842
<field id="expiration_period" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
3943
<label>Expiration Period</label>
4044
<comment>Consumer key/secret will expire if not used within X seconds after Oauth token exchange starts.</comment>
45+
<validate>required-entry validate-zero-or-greater validate-number</validate>
4146
</field>
4247
<field id="post_maxredirects" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
4348
<label>OAuth consumer credentials HTTP Post maxredirects</label>
4449
<comment>Number of maximum redirects for OAuth consumer credentials Post request.</comment>
50+
<validate>required-entry validate-zero-or-greater validate-digits</validate>
4551
</field>
4652
<field id="post_timeout" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
4753
<label>OAuth consumer credentials HTTP Post timeout</label>
4854
<comment>Timeout for OAuth consumer credentials Post request within X seconds.</comment>
55+
<validate>required-entry validate-zero-or-greater validate-number</validate>
4956
</field>
5057
</group>
5158
<group id="authentication_lock" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0">
5259
<label>Authentication Locks</label>
5360
<field id="max_failures_count" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
5461
<label>Maximum Login Failures to Lock Out Account</label>
5562
<comment>Maximum Number of authentication failures to lock out account.</comment>
63+
<validate>required-entry validate-zero-or-greater validate-digits</validate>
5664
</field>
5765
<field id="timeout" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
5866
<label>Lockout Time (seconds)</label>
5967
<comment>Period of time in seconds after which account will be unlocked.</comment>
68+
<validate>required-entry validate-zero-or-greater validate-number</validate>
6069
</field>
6170
</group>
62-
6371
</section>
6472
</system>
6573
</config>

app/code/Magento/Store/Model/System/Store.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Store\Model\System;
710

811
use Magento\Framework\Data\OptionSourceInterface;
@@ -118,6 +121,7 @@ public function getStoreValuesForForm($empty = false, $all = false)
118121
$options[] = ['label' => __('All Store Views'), 'value' => 0];
119122
}
120123

124+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
121125
$nonEscapableNbspChar = html_entity_decode('&#160;', ENT_NOQUOTES, 'UTF-8');
122126

123127
foreach ($this->_websiteCollection as $website) {
@@ -126,7 +130,7 @@ public function getStoreValuesForForm($empty = false, $all = false)
126130
if ($website->getId() != $group->getWebsiteId()) {
127131
continue;
128132
}
129-
$groupShow = false;
133+
$values = [];
130134
foreach ($this->_storeCollection as $store) {
131135
if ($group->getId() != $store->getGroupId()) {
132136
continue;
@@ -135,16 +139,12 @@ public function getStoreValuesForForm($empty = false, $all = false)
135139
$options[] = ['label' => $website->getName(), 'value' => []];
136140
$websiteShow = true;
137141
}
138-
if (!$groupShow) {
139-
$groupShow = true;
140-
$values = [];
141-
}
142142
$values[] = [
143143
'label' => str_repeat($nonEscapableNbspChar, 4) . $store->getName(),
144144
'value' => $store->getId(),
145145
];
146146
}
147-
if ($groupShow) {
147+
if (!empty($values)) {
148148
$options[] = [
149149
'label' => str_repeat($nonEscapableNbspChar, 4) . $group->getName(),
150150
'value' => $values,
@@ -398,6 +398,7 @@ public function getStoreCollection()
398398

399399
/**
400400
* Load/Reload collection(s) by type
401+
*
401402
* Allowed types: website, group, store or null for all
402403
*
403404
* @param string $type

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Widget\Model\Widget;
710

811
/**
@@ -198,8 +201,9 @@ public function decodeWidgetsFromQuery($queryParam)
198201
*/
199202
public function getAvailableWidgets($config)
200203
{
204+
$result = [];
205+
201206
if (!$config->hasData('widget_types')) {
202-
$result = [];
203207
$allWidgets = $this->_widgetFactory->create()->getWidgetsArray();
204208
$skipped = $this->_getSkippedWidgets();
205209
foreach ($allWidgets as $widget) {

lib/internal/Magento/Framework/Locale/Test/Unit/TranslatedListsTest.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,42 @@
66

77
namespace Magento\Framework\Locale\Test\Unit;
88

9-
class TranslatedListsTest extends \PHPUnit\Framework\TestCase
9+
use Magento\Framework\Locale\ConfigInterface;
10+
use Magento\Framework\Locale\ResolverInterface;
11+
use Magento\Framework\Locale\TranslatedLists;
12+
use PHPUnit\Framework\MockObject\MockObject;
13+
use PHPUnit\Framework\TestCase;
14+
15+
class TranslatedListsTest extends TestCase
1016
{
1117
/**
12-
* @var \Magento\Framework\Locale\TranslatedLists
18+
* @var TranslatedLists
1319
*/
1420
protected $listsModel;
1521

1622
/**
17-
* @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Locale\ConfigInterface
23+
* @var MockObject | ConfigInterface
1824
*/
1925
protected $mockConfig;
2026

2127
/**
22-
* @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Locale\ResolverInterface
28+
* @var MockObject | ResolverInterface
2329
*/
2430
protected $mockLocaleResolver;
2531

2632
protected function setUp()
2733
{
28-
$this->mockConfig = $this->getMockBuilder(\Magento\Framework\Locale\ConfigInterface::class)
34+
$this->mockConfig = $this->getMockBuilder(ConfigInterface::class)
2935
->disableOriginalConstructor()
3036
->getMock();
31-
$this->mockLocaleResolver = $this->getMockBuilder(\Magento\Framework\Locale\ResolverInterface::class)
37+
$this->mockLocaleResolver = $this->getMockBuilder(ResolverInterface::class)
3238
->disableOriginalConstructor()
3339
->getMock();
3440
$this->mockLocaleResolver->expects($this->once())
3541
->method('getLocale')
36-
->will($this->returnValue('en_US'));
42+
->willReturn('en_US');
3743

38-
$this->listsModel = new \Magento\Framework\Locale\TranslatedLists(
44+
$this->listsModel = new TranslatedLists(
3945
$this->mockConfig,
4046
$this->mockLocaleResolver
4147
);
@@ -67,13 +73,13 @@ public function testGetOptionCurrencies()
6773

6874
$this->mockConfig->expects($this->once())
6975
->method('getAllowedCurrencies')
70-
->will($this->returnValue($allowedCurrencies));
76+
->willReturn($allowedCurrencies);
7177

7278
$expectedResults = ['USD', 'EUR', 'GBP', 'UAH'];
7379

7480
$currencyList = $this->listsModel->getOptionCurrencies();
7581
$currencyCodes = array_map(
76-
function ($data) {
82+
static function ($data) {
7783
return $data['value'];
7884
},
7985
$currencyList
@@ -166,6 +172,6 @@ protected function setupForOptionLocales()
166172
$allowedLocales = ['en_US', 'uk_UA', 'de_DE'];
167173
$this->mockConfig->expects($this->once())
168174
->method('getAllowedLocales')
169-
->will($this->returnValue($allowedLocales));
175+
->willReturn($allowedLocales);
170176
}
171177
}

lib/internal/Magento/Framework/Locale/TranslatedLists.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use Magento\Framework\Locale\Bundle\LanguageBundle;
1212
use Magento\Framework\Locale\Bundle\RegionBundle;
1313

14+
/**
15+
* Translated lists.
16+
*/
1417
class TranslatedLists implements ListsInterface
1518
{
1619
/**
@@ -176,6 +179,8 @@ public function getOptionAllCurrencies()
176179
}
177180

178181
/**
182+
* Sort option array.
183+
*
179184
* @param array $option
180185
* @return array
181186
*/
@@ -199,9 +204,11 @@ protected function _sortOptionArray($option)
199204
public function getCountryTranslation($value, $locale = null)
200205
{
201206
if ($locale == null) {
202-
return (new RegionBundle())->get($this->localeResolver->getLocale())['Countries'][$value];
203-
} else {
204-
return (new RegionBundle())->get($locale)['Countries'][$value];
207+
$locale = $this->localeResolver->getLocale();
205208
}
209+
210+
$translation = (new RegionBundle())->get($locale)['Countries'][$value];
211+
212+
return $translation ? (string)__($translation) : $translation;
206213
}
207214
}

0 commit comments

Comments
 (0)