File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -302,4 +302,25 @@ public function testMetaSchemaFixes()
302302 $ this ->assertEquals ('uri-reference ' , $ draft_03 ->properties ->{'$ref ' }->format );
303303 $ this ->assertEquals ('uri-reference ' , $ draft_04 ->properties ->id ->format );
304304 }
305+
306+ public function testNoDoubleResolve ()
307+ {
308+ $ schemaOne = json_decode ('{"id": "test/schema", "$ref": "../test2/schema2"} ' );
309+
310+ $ uriRetriever = $ this ->prophesize ('JsonSchema\UriRetrieverInterface ' );
311+ $ uriRetriever ->retrieve ('test/schema ' )->willReturn ($ schemaOne )->shouldBeCalled ();
312+
313+ $ s = new SchemaStorage ($ uriRetriever ->reveal ());
314+ $ schema = $ s ->addSchema ('test/schema ' );
315+
316+ $ r = new \ReflectionObject ($ s );
317+ $ p = $ r ->getProperty ('schemas ' );
318+ $ p ->setAccessible (true );
319+ $ schemas = $ p ->getValue ($ s );
320+
321+ $ this ->assertEquals (
322+ 'file:// ' . getcwd () . '/test2/schema2# ' ,
323+ $ schemas ['test/schema ' ]->{'$ref ' }
324+ );
325+ }
305326}
You can’t perform that action at this time.
0 commit comments