@@ -222,7 +222,7 @@ public function testResolvePointerFragmentNoArray()
222
222
$ schema , 'http://example.org/schema.json#/definitions/foo '
223
223
);
224
224
}
225
-
225
+
226
226
/**
227
227
* @expectedException JsonSchema\Exception\UriResolverException
228
228
*/
@@ -233,4 +233,40 @@ public function testResolveExcessLevelUp()
233
233
'../schema.json# ' , 'http://example.org/schema.json# '
234
234
);
235
235
}
236
+
237
+ public function testConfirmMediaTypeAcceptsJsonSchemaType ()
238
+ {
239
+ $ retriever = $ this ->getMock ('JsonSchema\Uri\UriRetriever ' , array ('getContentType ' ));
240
+
241
+ $ retriever ->expects ($ this ->at (0 ))
242
+ ->method ('getContentType ' )
243
+ ->will ($ this ->returnValue ('application/schema+json ' ));
244
+
245
+ $ this ->assertEquals (null , $ retriever ->confirmMediaType ($ retriever , null ));
246
+ }
247
+
248
+ public function testConfirmMediaTypeAcceptsJsonType ()
249
+ {
250
+ $ retriever = $ this ->getMock ('JsonSchema\Uri\UriRetriever ' , array ('getContentType ' ));
251
+
252
+ $ retriever ->expects ($ this ->at (0 ))
253
+ ->method ('getContentType ' )
254
+ ->will ($ this ->returnValue ('application/json ' ));
255
+
256
+ $ this ->assertEquals (null , $ retriever ->confirmMediaType ($ retriever , null ));
257
+ }
258
+
259
+ /**
260
+ * @expectedException \JsonSchema\Exception\InvalidSchemaMediaTypeException
261
+ */
262
+ public function testConfirmMediaTypeThrowsExceptionForUnsupportedTypes ()
263
+ {
264
+ $ retriever = $ this ->getMock ('JsonSchema\Uri\UriRetriever ' , array ('getContentType ' ));
265
+
266
+ $ retriever ->expects ($ this ->at (0 ))
267
+ ->method ('getContentType ' )
268
+ ->will ($ this ->returnValue ('text/html ' ));
269
+
270
+ $ this ->assertEquals (null , $ retriever ->confirmMediaType ($ retriever , null ));
271
+ }
236
272
}
0 commit comments