@@ -20,13 +20,18 @@ private function setUpTests($isValid)
20
20
21
21
foreach ($ filePaths as $ path ) {
22
22
foreach (glob ($ path . '/*.json ' ) as $ file ) {
23
- if (!in_array (basename ($ file ), $ skippedTests )) {
23
+ $ filename = basename ($ file );
24
+ if (!in_array ($ filename , $ skippedTests )) {
24
25
$ suites = json_decode (file_get_contents ($ file ));
25
26
foreach ($ suites as $ suite ) {
27
+ $ suiteDescription = $ suite ->description ;
26
28
foreach ($ suite ->tests as $ test ) {
29
+ $ testCaseDescription = $ test ->description ;
27
30
if ($ isValid === $ test ->valid ) {
28
- $ tests [] = array (json_encode ($ test ->data ), json_encode ($ suite ->schema ));
29
- }
31
+ $ tests [
32
+ $ this ->createDataSetPath ($ filename , $ suiteDescription , $ testCaseDescription )
33
+ ] = array (json_encode ($ test ->data ), json_encode ($ suite ->schema ));
34
+ }
30
35
}
31
36
}
32
37
}
@@ -61,4 +66,19 @@ protected abstract function getFilePaths();
61
66
* @return string[]
62
67
*/
63
68
protected abstract function getSkippedTests ();
69
+
70
+ /**
71
+ * Generates a readable path to Json Schema Test Suite data set under test
72
+ *
73
+ * @param string $filename
74
+ * @param string $suiteDesc
75
+ * @param string $testCaseDesc
76
+ *
77
+ * @return string
78
+ */
79
+ private function createDataSetPath ($ filename , $ suiteDesc , $ testCaseDesc )
80
+ {
81
+ $ separator = ' / ' ;
82
+ return $ filename . $ separator . $ suiteDesc . $ separator . $ testCaseDesc ;
83
+ }
64
84
}
0 commit comments