3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
6
7
namespace Magento \FunctionalTestingFramework \Config ;
7
8
8
9
/**
9
- * Class SchemaLocator
10
- * Scenario configuration schema locator
10
+ * Configuration schema locator.
11
11
*/
12
12
class SchemaLocator implements \Magento \FunctionalTestingFramework \Config \SchemaLocatorInterface
13
13
{
14
14
/**
15
- * XSD schema path
15
+ * Path to corresponding XSD file with validation rules for merged config.
16
16
*
17
17
* @var string
18
18
*/
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
+
20
28
21
29
/**
22
30
* Class constructor
23
31
*
24
32
* @param string $schemaPath
33
+ * @param string|null $perFileSchema
25
34
*/
26
- public function __construct ($ schemaPath )
35
+ public function __construct ($ schemaPath, $ perFileSchema = null )
27
36
{
28
37
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 ;
30
42
} else {
31
43
$ path = dirname (dirname (dirname (__DIR__ )));
32
44
$ 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 ;
34
49
}
35
50
}
36
51
@@ -51,6 +66,6 @@ public function getSchema()
51
66
*/
52
67
public function getPerFileSchema ()
53
68
{
54
- return null ;
69
+ return $ this -> perFileSchema ;
55
70
}
56
71
}
0 commit comments