diff --git a/app/code/Magento/Config/Console/Command/ConfigShowCommand.php b/app/code/Magento/Config/Console/Command/ConfigShowCommand.php index 48ad50215d9da..b26e4bb173017 100644 --- a/app/code/Magento/Config/Console/Command/ConfigShowCommand.php +++ b/app/code/Magento/Config/Console/Command/ConfigShowCommand.php @@ -1,7 +1,7 @@ emulatedAreaProcessor->process(function () { return $this->localeEmulator->emulate(function () { $this->scopeValidator->isValid($this->scope, $this->scopeCode); - if ($this->inputPath) { - $pathValidator = $this->pathValidatorFactory->create(); - $pathValidator->validate($this->inputPath); - } $configPath = $this->pathResolver ->resolve($this->inputPath, $this->scope, $this->scopeCode); @@ -194,13 +191,19 @@ protected function execute(InputInterface $input, OutputInterface $output) ->resolve($this->inputPath, $this->scope, strtolower($this->scopeCode)); $value = $this->configSource->get($configPath); if (!$value) { - $value = $this->configSource->get(strtolower($configPath)); + $value = $this->configSource->get(strtolower((string)$configPath)); } } return $value; }); }); + if (empty($configValue)) { + throw new ValidatorException( + __('The "%1" path doesn\'t exist. Verify and try again.', $this->inputPath) + ); + } + $this->outputResult($output, $configValue, $this->inputPath); return Cli::RETURN_SUCCESS; } catch (\Exception $e) { diff --git a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigShowCommandTest.php b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigShowCommandTest.php index acdaa8111de4e..7ef7accfe838b 100644 --- a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigShowCommandTest.php +++ b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigShowCommandTest.php @@ -1,9 +1,8 @@ pathValidatorMock->expects($this->once()) - ->method('validate') - ->with(self::CONFIG_PATH) - ->willThrowException($exception); $this->emulatedAreProcessorMock->expects($this->once()) ->method('process') ->willReturnCallback(function ($function) { @@ -246,7 +237,7 @@ public function testConfigPathNotExist(): void $tester->getStatusCode() ); $this->assertStringContainsString( - __('The "%1" path doesn\'t exist. Verify and try again.', self::CONFIG_PATH)->render(), + __('The "%1" path doesn\'t exist. Verify and try again.', self::CONFIG_PATH)->render(), $tester->getDisplay() ); }