Skip to content

Commit 8629a81

Browse files
committed
AC-2519: admin config state option
1 parent 9d08ec6 commit 8629a81

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

app/code/Magento/Directory/Helper/Data.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,36 @@ class Data extends AbstractHelper
3333
/**
3434
* Config value that lists ISO2 country codes which have optional Zip/Postal pre-configured
3535
*/
36-
const OPTIONAL_ZIP_COUNTRIES_CONFIG_PATH = 'general/country/optional_zip_countries';
36+
public const OPTIONAL_ZIP_COUNTRIES_CONFIG_PATH = 'general/country/optional_zip_countries';
3737

38-
/*
38+
/**
3939
* Path to config value, which lists countries, for which state is required.
4040
*/
41-
const XML_PATH_STATES_REQUIRED = 'general/region/state_required';
41+
public const XML_PATH_STATES_REQUIRED = 'general/region/state_required';
4242

43-
/*
43+
/**
4444
* Path to config value, which detects whether or not display the state for the country, if it is not required
4545
*/
46-
const XML_PATH_DISPLAY_ALL_STATES = 'general/region/display_all';
46+
public const XML_PATH_DISPLAY_ALL_STATES = 'general/region/display_all';
4747

4848
/**#@+
4949
* Path to config value, which is default country
5050
*/
51-
const XML_PATH_DEFAULT_COUNTRY = 'general/country/default';
52-
const XML_PATH_DEFAULT_LOCALE = 'general/locale/code';
53-
const XML_PATH_DEFAULT_TIMEZONE = 'general/locale/timezone';
51+
public const XML_PATH_DEFAULT_COUNTRY = 'general/country/default';
52+
public const XML_PATH_DEFAULT_LOCALE = 'general/locale/code';
53+
public const XML_PATH_DEFAULT_TIMEZONE = 'general/locale/timezone';
5454
/**#@-*/
5555

5656
/**
5757
* Path to config value that contains codes of the most used countries.
5858
* Such countries can be shown on the top of the country list.
5959
*/
60-
const XML_PATH_TOP_COUNTRIES = 'general/country/destinations';
60+
public const XML_PATH_TOP_COUNTRIES = 'general/country/destinations';
6161

6262
/**
6363
* Path to config value that contains weight unit
6464
*/
65-
const XML_PATH_WEIGHT_UNIT = 'general/locale/weight_unit';
65+
public const XML_PATH_WEIGHT_UNIT = 'general/locale/weight_unit';
6666

6767
/**
6868
* @var Collection
@@ -234,7 +234,7 @@ public function getCountriesWithOptionalZip($asJson = false)
234234
{
235235
if (null === $this->_optZipCountries) {
236236
$value = trim(
237-
$this->scopeConfig->getValue(
237+
(string)$this->scopeConfig->getValue(
238238
self::OPTIONAL_ZIP_COUNTRIES_CONFIG_PATH,
239239
ScopeInterface::SCOPE_STORE
240240
)
@@ -268,7 +268,7 @@ public function isZipCodeOptional($countryCode)
268268
public function getCountriesWithStatesRequired($asJson = false)
269269
{
270270
$value = trim(
271-
$this->scopeConfig->getValue(
271+
(string)$this->scopeConfig->getValue(
272272
self::XML_PATH_STATES_REQUIRED,
273273
ScopeInterface::SCOPE_STORE
274274
)

app/code/Magento/Directory/Test/Unit/Helper/DataTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public static function countriesCommaListDataProvider()
226226
{
227227
return [
228228
'empty_list' => ['', []],
229+
'null_list' => [null, []],
229230
'normal_list' => ['Country1,Country2', ['Country1', 'Country2']]
230231
];
231232
}

0 commit comments

Comments
 (0)