@@ -71,6 +71,7 @@ public function testFileResolver()
7171 function testFileReference ()
7272 {
7373 $ pathToExternalSchema = __DIR__ . '/../../../resources/remotes/subSchemas.json ' ;
74+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
7475 $ schemaData = json_decode (<<<JSON
7576{" \$ref": "file:// $ pathToExternalSchema#/integer"}
7677JSON
@@ -86,6 +87,7 @@ function testFileReference()
8687 function testFileReferenceCapitalized ()
8788 {
8889 $ pathToExternalSchema = __DIR__ . '/../../../resources/remotes/subSchemas.json ' ;
90+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
8991 $ schemaData = json_decode (<<<JSON
9092{" \$ref": "FILE:// $ pathToExternalSchema#/integer"}
9193JSON
@@ -101,6 +103,7 @@ function testFileReferenceCapitalized()
101103 function testFileReferenceRealpath ()
102104 {
103105 $ pathToExternalSchema = realpath (__DIR__ . '/../../../resources/remotes/subSchemas.json ' );
106+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
104107 $ schemaData = json_decode (<<<JSON
105108{" \$ref": "file:// $ pathToExternalSchema#/integer"}
106109JSON
@@ -117,6 +120,7 @@ function testFileReferenceRealpathWithSpecialCharacters()
117120 {
118121 $ pathToExternalSchema = realpath (__DIR__ . '/../../../resources/remotes/#special~characters%directory/subSchemas.json ' );
119122 $ pathToExternalSchema = str_replace ('#special~characters%directory ' , rawurlencode ('#special~characters%directory ' ), $ pathToExternalSchema );
123+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
120124 $ schemaData = json_decode (<<<JSON
121125{" \$ref": "file:// $ pathToExternalSchema#/integer"}
122126JSON
@@ -132,6 +136,7 @@ function testFileReferenceRealpathWithSpecialCharacters()
132136 function testFileReferenceNoProtocolScheme ()
133137 {
134138 $ pathToExternalSchema = __DIR__ . '/../../../resources/remotes/subSchemas.json ' ;
139+ $ pathToExternalSchema = $ this ->preparePath ($ pathToExternalSchema );
135140 $ schemaData = json_decode (<<<JSON
136141{" \$ref": " $ pathToExternalSchema#/integer"}
137142JSON
@@ -144,4 +149,11 @@ function testFileReferenceNoProtocolScheme()
144149 $ schema ->in ('abc ' );
145150 }
146151
152+ private function preparePath ($ path )
153+ {
154+ if (DIRECTORY_SEPARATOR === '\\' ) {
155+ return str_replace ('\\' , '/ ' , $ path );
156+ }
157+ return $ path ;
158+ }
147159}
0 commit comments