33 * Copyright © Magento, Inc. All rights reserved.
44 * See COPYING.txt for license details.
55 */
6+
67namespace Magento \FunctionalTestingFramework \Config ;
78
89/**
9- * Class SchemaLocator
10- * Scenario configuration schema locator
10+ * Configuration schema locator.
1111 */
1212class SchemaLocator implements \Magento \FunctionalTestingFramework \Config \SchemaLocatorInterface
1313{
1414 /**
15- * XSD schema path
15+ * Path to corresponding XSD file with validation rules for merged config.
1616 *
1717 * @var string
1818 */
19- protected $ schemaPath ;
19+ private $ schemaPath ;
20+
21+ /**
22+ * Path to corresponding XSD file with validation rules for separate config files.
23+ *
24+ * @var string
25+ */
26+ private $ perFileSchema ;
27+
2028
2129 /**
2230 * Class constructor
2331 *
2432 * @param string $schemaPath
33+ * @param string|null $perFileSchema
2534 */
26- public function __construct ($ schemaPath )
35+ public function __construct ($ schemaPath, $ perFileSchema = null )
2736 {
2837 if (constant ('FW_BP ' ) && file_exists (FW_BP . DIRECTORY_SEPARATOR . $ schemaPath )) {
29- $ this ->schemaPath = FW_BP . DIRECTORY_SEPARATOR . $ schemaPath ;
38+ $ this ->schemaPath = FW_BP . DIRECTORY_SEPARATOR . $ schemaPath ;
39+ $ this ->perFileSchema = $ perFileSchema === null
40+ ? $ this ->schemaPath
41+ : FW_BP . DIRECTORY_SEPARATOR . $ perFileSchema ;
3042 } else {
3143 $ path = dirname (dirname (dirname (__DIR__ )));
3244 $ path = str_replace ('\\' , DIRECTORY_SEPARATOR , $ path );
33- $ this ->schemaPath = $ path . DIRECTORY_SEPARATOR . $ schemaPath ;
45+ $ this ->schemaPath = $ path . DIRECTORY_SEPARATOR . $ schemaPath ;
46+ $ this ->perFileSchema = $ perFileSchema === null
47+ ? $ this ->schemaPath
48+ : $ path . DIRECTORY_SEPARATOR . $ perFileSchema ;
3449 }
3550 }
3651
@@ -51,6 +66,6 @@ public function getSchema()
5166 */
5267 public function getPerFileSchema ()
5368 {
54- return null ;
69+ return $ this -> perFileSchema ;
5570 }
5671}
0 commit comments