Skip to content

Commit 708104b

Browse files
MAGETWO-64226: Add paths validation
1 parent 56b04ac commit 708104b

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

app/code/Magento/Config/Console/Command/ConfigSetCommand.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,38 @@ class ConfigSetCommand extends Command
3434
/**#@-*/
3535

3636
/**
37+
* The factory for config:set processors.
38+
*
3739
* @var ConfigSetProcessorFactory
3840
*/
3941
private $configSetProcessorFactory;
4042

4143
/**
44+
* Scope validator.
45+
*
4246
* @var ValidatorInterface
4347
*/
4448
private $validator;
4549

4650
/**
51+
* Scope manager.
52+
*
4753
* @var ScopeInterface
4854
*/
4955
private $scope;
5056

5157
/**
58+
* The factory for path validator.
59+
*
5260
* @var PathValidatorFactory
5361
*/
5462
private $pathValidatorFactory;
5563

5664
/**
57-
* @param ConfigSetProcessorFactory $configSetProcessorFactory
58-
* @param ValidatorInterface $validator
59-
* @param ScopeInterface $scope
60-
* @param PathValidatorFactory $pathValidatorFactory
65+
* @param ConfigSetProcessorFactory $configSetProcessorFactory The factory for config:set processors
66+
* @param ValidatorInterface $validator Scope validator
67+
* @param ScopeInterface $scope Scope manager
68+
* @param PathValidatorFactory $pathValidatorFactory The factory for path validator
6169
*/
6270
public function __construct(
6371
ConfigSetProcessorFactory $configSetProcessorFactory,

app/code/Magento/Config/Model/Config/PathValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function __construct(Structure $structure)
3131
* Validates the config path by config structure schema.
3232
*
3333
* @param string $path The config path
34-
* @return bool
35-
* @throws ValidatorException If provided path can not be validated
34+
* @return bool The result of validation
35+
* @throws ValidatorException If provided path is not valid
3636
*/
3737
public function validate($path)
3838
{

app/code/Magento/Config/Model/Config/Structure.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
namespace Magento\Config\Model\Config;
67

78
/**
8-
* System configuration structure
9+
* System configuration structure.
910
*/
10-
namespace Magento\Config\Model\Config;
11-
1211
class Structure implements \Magento\Config\Model\Config\Structure\SearchInterface
1312
{
1413
/**
@@ -275,8 +274,8 @@ public function getFieldPaths()
275274
/**
276275
* Iteration that collects config field paths recursively from config schema.
277276
*
278-
* @param array $elements
279-
* @return array
277+
* @param array $elements The elements to be parsed
278+
* @return array An array of config path to config structure path map
280279
*/
281280
private function getFieldsRecursively(array $elements = [])
282281
{

app/code/Magento/Config/Test/Unit/Model/Config/PathValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testValidate()
5757
* @expectedException \Magento\Framework\Exception\ValidatorException
5858
* @expectedExceptionMessage The "test/test/test" path does not exists
5959
*/
60-
public function testValidateIwthException()
60+
public function testValidateWithException()
6161
{
6262
$this->structureMock->expects($this->once())
6363
->method('getFieldPaths')

0 commit comments

Comments
 (0)