@@ -28,8 +28,9 @@ public function testInvalidCases(string $input, string $schema, ?int $checkMode
2828 $ checkMode |= Constraint::CHECK_MODE_VALIDATE_SCHEMA ;
2929 }
3030
31- $ schemaStorage = new SchemaStorage ($ this ->getUriRetrieverMock (json_decode ($ schema , false )));
32- $ schema = $ schemaStorage ->getSchema ('http://www.my-domain.com/schema.json ' );
31+ $ schema = json_decode ($ schema , false );
32+ $ schemaStorage = new SchemaStorage ($ this ->getUriRetrieverMock ($ schema ));
33+ $ schema = $ schemaStorage ->getSchema ($ schema ->id ?? 'http://www.my-domain.com/schema.json ' );
3334 if (is_object ($ schema ) && !isset ($ schema ->{'$schema ' })) {
3435 $ schema ->{'$schema ' } = $ this ->schemaSpec ;
3536 }
@@ -60,8 +61,9 @@ public function testInvalidCasesUsingAssoc($input, $schema, $checkMode = Constra
6061 $ this ->markTestSkipped ('Test indicates that it is not for "CHECK_MODE_TYPE_CAST" ' );
6162 }
6263
63- $ schemaStorage = new SchemaStorage ($ this ->getUriRetrieverMock (json_decode ($ schema )));
64- $ schema = $ schemaStorage ->getSchema ('http://www.my-domain.com/schema.json ' );
64+ $ schema = json_decode ($ schema , false );
65+ $ schemaStorage = new SchemaStorage ($ this ->getUriRetrieverMock ($ schema ));
66+ $ schema = $ schemaStorage ->getSchema ($ schema ->id ?? 'http://www.my-domain.com/schema.json ' );
6567 if (is_object ($ schema ) && !isset ($ schema ->{'$schema ' })) {
6668 $ schema ->{'$schema ' } = $ this ->schemaSpec ;
6769 }
@@ -87,8 +89,10 @@ public function testValidCases($input, $schema, $checkMode = Constraint::CHECK_M
8789 if ($ this ->validateSchema ) {
8890 $ checkMode |= Constraint::CHECK_MODE_VALIDATE_SCHEMA ;
8991 }
90- $ schemaStorage = new SchemaStorage ($ this ->getUriRetrieverMock (json_decode ($ schema , false )));
91- $ schema = $ schemaStorage ->getSchema ('http://www.my-domain.com/schema.json ' );
92+
93+ $ schema = json_decode ($ schema , false );
94+ $ schemaStorage = new SchemaStorage ($ this ->getUriRetrieverMock ($ schema ));
95+ $ schema = $ schemaStorage ->getSchema ($ schema ->id ?? 'http://www.my-domain.com/schema.json ' );
9296 if (is_object ($ schema ) && !isset ($ schema ->{'$schema ' })) {
9397 $ schema ->{'$schema ' } = $ this ->schemaSpec ;
9498 }
@@ -113,9 +117,9 @@ public function testValidCasesUsingAssoc($input, $schema, $checkMode = Constrain
113117 $ this ->markTestSkipped ('Test indicates that it is not for "CHECK_MODE_TYPE_CAST" ' );
114118 }
115119
116- $ schema = json_decode ($ schema );
120+ $ schema = json_decode ($ schema, false );
117121 $ schemaStorage = new SchemaStorage ($ this ->getUriRetrieverMock ($ schema ), new UriResolver ());
118- $ schema = $ schemaStorage ->getSchema ('http://www.my-domain.com/schema.json ' );
122+ $ schema = $ schemaStorage ->getSchema ($ schema -> id ?? 'http://www.my-domain.com/schema.json ' );
119123 if (is_object ($ schema ) && !isset ($ schema ->{'$schema ' })) {
120124 $ schema ->{'$schema ' } = $ this ->schemaSpec ;
121125 }
0 commit comments