@@ -71,6 +71,7 @@ public function testFileResolver()
71
71
function testFileReference ()
72
72
{
73
73
$ pathToExternalSchema = __DIR__ . '/../../../resources/remotes/subSchemas.json ' ;
74
+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
74
75
$ schemaData = json_decode (<<<JSON
75
76
{" \$ref": "file:// $ pathToExternalSchema#/integer"}
76
77
JSON
@@ -86,6 +87,7 @@ function testFileReference()
86
87
function testFileReferenceCapitalized ()
87
88
{
88
89
$ pathToExternalSchema = __DIR__ . '/../../../resources/remotes/subSchemas.json ' ;
90
+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
89
91
$ schemaData = json_decode (<<<JSON
90
92
{" \$ref": "FILE:// $ pathToExternalSchema#/integer"}
91
93
JSON
@@ -101,6 +103,7 @@ function testFileReferenceCapitalized()
101
103
function testFileReferenceRealpath ()
102
104
{
103
105
$ pathToExternalSchema = realpath (__DIR__ . '/../../../resources/remotes/subSchemas.json ' );
106
+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
104
107
$ schemaData = json_decode (<<<JSON
105
108
{" \$ref": "file:// $ pathToExternalSchema#/integer"}
106
109
JSON
@@ -117,6 +120,7 @@ function testFileReferenceRealpathWithSpecialCharacters()
117
120
{
118
121
$ pathToExternalSchema = realpath (__DIR__ . '/../../../resources/remotes/#special~characters%directory/subSchemas.json ' );
119
122
$ pathToExternalSchema = str_replace ('#special~characters%directory ' , rawurlencode ('#special~characters%directory ' ), $ pathToExternalSchema );
123
+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
120
124
$ schemaData = json_decode (<<<JSON
121
125
{" \$ref": "file:// $ pathToExternalSchema#/integer"}
122
126
JSON
@@ -132,6 +136,7 @@ function testFileReferenceRealpathWithSpecialCharacters()
132
136
function testFileReferenceNoProtocolScheme ()
133
137
{
134
138
$ pathToExternalSchema = __DIR__ . '/../../../resources/remotes/subSchemas.json ' ;
139
+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
135
140
$ schemaData = json_decode (<<<JSON
136
141
{" \$ref": " $ pathToExternalSchema#/integer"}
137
142
JSON
@@ -144,4 +149,11 @@ function testFileReferenceNoProtocolScheme()
144
149
$ schema ->in ('abc ' );
145
150
}
146
151
152
+ private function preparePath ($ path )
153
+ {
154
+ if (DIRECTORY_SEPARATOR === '\\' ) {
155
+ return str_replace ('\\' , '/ ' , $ path );
156
+ }
157
+ return $ path ;
158
+ }
147
159
}
0 commit comments