Skip to content

Commit d4ca5b8

Browse files
author
Maksym Savich
committed
Merge branch 'MAGETWO-32624' of https://github.corp.ebay.com/magento-extensibility/magento2ce into MAGETWO-32624
2 parents b53cbb7 + 499c91b commit d4ca5b8

File tree

27 files changed

+137
-75
lines changed

27 files changed

+137
-75
lines changed

app/code/Magento/Backend/Model/Locale/Manager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
namespace Magento\Backend\Model\Locale;
7+
use Magento\Framework\Locale\Resolver;
78

89
/**
910
* Locale manager model
@@ -68,7 +69,7 @@ public function switchBackendInterfaceLocale($localeCode)
6869
*/
6970
public function getUserInterfaceLocale()
7071
{
71-
$interfaceLocale = \Magento\Framework\Locale\ResolverInterface::DEFAULT_LOCALE;
72+
$interfaceLocale = Resolver::DEFAULT_LOCALE;
7273

7374
$userData = $this->_authSession->getUser();
7475
if ($userData && $userData->getInterfaceLocale()) {

app/code/Magento/Backend/Test/Unit/Model/Locale/ManagerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Backend\Test\Unit\Model\Locale;
77

8+
use Magento\Framework\Locale\Resolver;
9+
810
class ManagerTest extends \PHPUnit_Framework_TestCase
911
{
1012
/**
@@ -87,7 +89,7 @@ public function testGetUserInterfaceLocaleDefault()
8789
{
8890
$locale = $this->_model->getUserInterfaceLocale();
8991

90-
$this->assertEquals($locale, \Magento\Framework\Locale\ResolverInterface::DEFAULT_LOCALE);
92+
$this->assertEquals($locale, Resolver::DEFAULT_LOCALE);
9193
}
9294

9395
/**

app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use Magento\Framework\Exception\NoSuchEntityException;
1212
use Magento\Customer\Block\Widget\Dob;
13+
use Magento\Framework\Locale\Resolver;
1314

1415
class DobTest extends \PHPUnit_Framework_TestCase
1516
{
@@ -69,7 +70,7 @@ public function setUp()
6970
$localeResolver = $this->getMock('\Magento\Framework\Locale\ResolverInterface');
7071
$localeResolver->expects($this->any())
7172
->method('getLocale')
72-
->willReturn(\Magento\Framework\Locale\ResolverInterface::DEFAULT_LOCALE);
73+
->willReturn(Resolver::DEFAULT_LOCALE);
7374
$timezone = $objectManager->getObject(
7475
'Magento\Framework\Stdlib\DateTime\Timezone',
7576
['localeResolver' => $localeResolver]

app/code/Magento/Store/Model/Config/Reader/DefaultReader.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*/
88
namespace Magento\Store\Model\Config\Reader;
99

10+
use Magento\Framework\App\Config\ScopeConfigInterface;
11+
1012
class DefaultReader implements \Magento\Framework\App\Config\Scope\ReaderInterface
1113
{
1214
/**
@@ -42,14 +44,21 @@ public function __construct(
4244
/**
4345
* Read configuration data
4446
*
47+
* @param null|string $scope
48+
* @throws \Magento\Framework\Exception Exception is thrown when scope other than default is given
4549
* @return array
4650
*/
47-
public function read()
51+
public function read($scope = ScopeConfigInterface::SCOPE_DEFAULT)
4852
{
49-
$config = $this->_initialConfig->getData(\Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT);
53+
$scope = $scope === null ? ScopeConfigInterface::SCOPE_DEFAULT : $scope;
54+
if ($scope !== ScopeConfigInterface::SCOPE_DEFAULT) {
55+
throw new \Magento\Framework\Exception("Only default scope allowed");
56+
}
57+
58+
$config = $this->_initialConfig->getData($scope);
5059

5160
$collection = $this->_collectionFactory->create(
52-
['scope' => \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT]
61+
['scope' => $scope]
5362
);
5463
$dbDefaultConfig = [];
5564
foreach ($collection as $item) {

app/code/Magento/Store/Model/Config/Reader/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct(
6666
/**
6767
* Read configuration by code
6868
*
69-
* @param string $code
69+
* @param null|string $code
7070
* @return array
7171
* @throws NoSuchEntityException
7272
*/

app/code/Magento/User/Controller/Adminhtml/User/Edit.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
*/
77
namespace Magento\User\Controller\Adminhtml\User;
88

9+
use Magento\Framework\Locale\Resolver;
10+
911
class Edit extends \Magento\User\Controller\Adminhtml\User
1012
{
1113
/**
@@ -25,7 +27,7 @@ public function execute()
2527
return;
2628
}
2729
} else {
28-
$model->setInterfaceLocale(\Magento\Framework\Locale\ResolverInterface::DEFAULT_LOCALE);
30+
$model->setInterfaceLocale(Resolver::DEFAULT_LOCALE);
2931
}
3032

3133
// Restore previously entered form data from session

dev/tests/integration/testsuite/Magento/Backend/Model/Locale/ResolverTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
namespace Magento\Backend\Model\Locale;
7+
use Magento\Framework\Locale\Resolver;
78

89
/**
910
* @magentoAppArea adminhtml
@@ -28,7 +29,7 @@ protected function setUp()
2829
*/
2930
public function testSetLocaleWithDefaultLocale()
3031
{
31-
$this->_checkSetLocale(\Magento\Framework\Locale\ResolverInterface::DEFAULT_LOCALE);
32+
$this->_checkSetLocale(Resolver::DEFAULT_LOCALE);
3233
}
3334

3435
/**

lib/internal/Magento/Framework/App/Config/Initial.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ public function __construct(
5050
/**
5151
* Get initial data by given scope
5252
*
53-
* @param string $scope
53+
* @param string $scope Format is scope type and scope code separated by pipe: e.g. "type|code"
5454
* @return array
55+
*
56+
* @api
5557
*/
5658
public function getData($scope)
5759
{
@@ -69,6 +71,8 @@ public function getData($scope)
6971
* Get configuration metadata
7072
*
7173
* @return array
74+
*
75+
* @api
7276
*/
7377
public function getMetadata()
7478
{

lib/internal/Magento/Framework/App/Config/MutableScopeConfigInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
namespace Magento\Framework\App\Config;
1010

11+
/**
12+
* @api
13+
*/
1114
interface MutableScopeConfigInterface extends \Magento\Framework\App\Config\ScopeConfigInterface
1215
{
1316
/**

lib/internal/Magento/Framework/App/Config/ReinitableConfigInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
namespace Magento\Framework\App\Config;
1010

11+
/**
12+
* @api
13+
*/
1114
interface ReinitableConfigInterface extends \Magento\Framework\App\Config\MutableScopeConfigInterface
1215
{
1316
/**

0 commit comments

Comments
 (0)