@@ -28,8 +28,9 @@ public function testInvalidCases(string $input, string $schema, ?int $checkMode
28
28
$ checkMode |= Constraint::CHECK_MODE_VALIDATE_SCHEMA ;
29
29
}
30
30
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 ' );
33
34
if (is_object ($ schema ) && !isset ($ schema ->{'$schema ' })) {
34
35
$ schema ->{'$schema ' } = $ this ->schemaSpec ;
35
36
}
@@ -60,8 +61,9 @@ public function testInvalidCasesUsingAssoc($input, $schema, $checkMode = Constra
60
61
$ this ->markTestSkipped ('Test indicates that it is not for "CHECK_MODE_TYPE_CAST" ' );
61
62
}
62
63
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 ' );
65
67
if (is_object ($ schema ) && !isset ($ schema ->{'$schema ' })) {
66
68
$ schema ->{'$schema ' } = $ this ->schemaSpec ;
67
69
}
@@ -87,8 +89,10 @@ public function testValidCases($input, $schema, $checkMode = Constraint::CHECK_M
87
89
if ($ this ->validateSchema ) {
88
90
$ checkMode |= Constraint::CHECK_MODE_VALIDATE_SCHEMA ;
89
91
}
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 ' );
92
96
if (is_object ($ schema ) && !isset ($ schema ->{'$schema ' })) {
93
97
$ schema ->{'$schema ' } = $ this ->schemaSpec ;
94
98
}
@@ -113,9 +117,9 @@ public function testValidCasesUsingAssoc($input, $schema, $checkMode = Constrain
113
117
$ this ->markTestSkipped ('Test indicates that it is not for "CHECK_MODE_TYPE_CAST" ' );
114
118
}
115
119
116
- $ schema = json_decode ($ schema );
120
+ $ schema = json_decode ($ schema, false );
117
121
$ 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 ' );
119
123
if (is_object ($ schema ) && !isset ($ schema ->{'$schema ' })) {
120
124
$ schema ->{'$schema ' } = $ this ->schemaSpec ;
121
125
}
0 commit comments