Skip to content

Commit a1ad02e

Browse files
ENGCOM-2281: 'Allowed Countries' - get countries for scope 'default'. #16693
- Merge Pull Request #16693 from swnsma/magento2-1:Allowed-Countries-Get-Countries-For-Default-Scope - Merged commits: 1. 72cb244 2. e56cbde
2 parents 9d74001 + e56cbde commit a1ad02e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

app/code/Magento/Directory/Model/AllowedCountries.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function getAllowedCountries(
5555
$scope = ScopeInterface::SCOPE_WEBSITE,
5656
$scopeCode = null
5757
) {
58-
if (empty($scopeCode)) {
58+
if ($scopeCode === null) {
5959
$scopeCode = $this->getDefaultScopeCode($scope);
6060
}
6161

app/code/Magento/Directory/Test/Unit/Model/AllowedCountriesTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,20 @@ public function testGetAllowedCountries()
7070
$this->allowedCountriesReader->getAllowedCountries(ScopeInterface::SCOPE_WEBSITE, true)
7171
);
7272
}
73+
74+
public function testGetAllowedCountriesDefaultScope()
75+
{
76+
$this->storeManagerMock->expects($this->never())
77+
->method('getStore');
78+
79+
$this->scopeConfigMock->expects($this->once())
80+
->method('getValue')
81+
->with(AllowedCountries::ALLOWED_COUNTRIES_PATH, ScopeInterface::SCOPE_STORE, 0)
82+
->willReturn('AM');
83+
84+
$this->assertEquals(
85+
['AM' => 'AM'],
86+
$this->allowedCountriesReader->getAllowedCountries(ScopeInterface::SCOPE_STORE, 0)
87+
);
88+
}
7389
}

0 commit comments

Comments
 (0)