Skip to content

Commit 46ace61

Browse files
committed
MAGETWO-63382: CLI Improvements: Configuration management - Command config:show
1 parent c38893e commit 46ace61

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

app/code/Magento/Config/Console/Command/ConfigShow/ConfigSourceAggregated.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ public function get($path = '')
3838
foreach ($this->sources as $sourceConfig) {
3939
/** @var ConfigSourceInterface $source */
4040
$source = $sourceConfig['source'];
41-
$data = array_replace_recursive($data, $source->get($path));
41+
$configData = $source->get($path);
42+
if (!is_array($configData)) {
43+
return $configData;
44+
}
45+
$data = array_replace_recursive($data, $configData);
4246
}
47+
4348
return $data;
4449
}
4550

dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigShowCommandTest.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Config\Console\Command;
77

8+
use Magento\Config\Console\Command\ConfigShow\ConfigSourceAggregated;
9+
use Magento\Framework\App\Config\ScopePathResolver;
810
use Magento\Store\Model\ScopeInterface;
911
use Magento\TestFramework\Helper\Bootstrap;
1012
use Magento\Framework\App\Config\ScopeConfigInterface;
@@ -20,19 +22,25 @@ class ConfigShowCommandTest extends \PHPUnit_Framework_TestCase
2022
private $objectManager;
2123

2224
/**
23-
* @var ScopeConfigInterface
25+
* @var ConfigSourceAggregated
2426
*/
25-
private $appConfig;
27+
private $config;
2628

2729
/**
2830
* @var CommandTester
2931
*/
3032
private $commandTester;
3133

34+
/**
35+
* @var ScopePathResolver
36+
*/
37+
private $pathResolver;
38+
3239
public function setUp()
3340
{
3441
$this->objectManager = Bootstrap::getObjectManager();
35-
$this->appConfig = $this->objectManager->get(ScopeConfigInterface::class);
42+
$this->config = $this->objectManager->get(ConfigSourceAggregated::class);
43+
$this->pathResolver = $this->objectManager->get(ScopePathResolver::class);
3644

3745
$command = $this->objectManager->create(ConfigShowCommand::class);
3846
$this->commandTester = new CommandTester($command);
@@ -48,9 +56,9 @@ public function setUp()
4856
*/
4957
public function testExecute($scope, $scopeCode, array $configs)
5058
{
51-
foreach ($configs as $configPath => $configValue) {
59+
foreach ($configs as $inputPath => $configValue) {
5260
$arguments = [
53-
ConfigShowCommand::INPUT_ARGUMENT_PATH => $configPath
61+
ConfigShowCommand::INPUT_ARGUMENT_PATH => $inputPath
5462
];
5563

5664
if ($scope !== null) {
@@ -62,7 +70,8 @@ public function testExecute($scope, $scopeCode, array $configs)
6270

6371
$this->commandTester->execute($arguments);
6472

65-
$appConfigValue = $this->appConfig->getValue($configPath, $scope, $scopeCode);
73+
$configPath = $this->pathResolver->resolve($inputPath, $scope, $scopeCode);
74+
$appConfigValue = $this->config->get($configPath);
6675
$this->assertEquals(
6776
Cli::RETURN_SUCCESS,
6877
$this->commandTester->getStatusCode()

0 commit comments

Comments
 (0)