9
9
10
10
namespace JsonSchema \Tests \Uri ;
11
11
12
+ use JsonSchema \Exception \InvalidSchemaMediaTypeException ;
12
13
use JsonSchema \Exception \JsonDecodingException ;
14
+ use JsonSchema \Exception \ResourceNotFoundException ;
15
+ use JsonSchema \Exception \UriResolverException ;
13
16
use JsonSchema \Uri \UriRetriever ;
14
17
use JsonSchema \Validator ;
15
18
use PHPUnit \Framework \TestCase ;
@@ -34,7 +37,7 @@ private function getRetrieverMock($returnSchema)
34
37
throw new JsonDecodingException ($ error );
35
38
}
36
39
37
- $ retriever = $ this ->getMock ('JsonSchema\Uri\UriRetriever ' , array ( ' retrieve ' ) );
40
+ $ retriever = $ this ->createMock ('JsonSchema\Uri\UriRetriever ' );
38
41
39
42
$ retriever ->expects ($ this ->at (0 ))
40
43
->method ('retrieve ' )
@@ -232,7 +235,7 @@ public function testResolveExcessLevelUp()
232
235
233
236
public function testConfirmMediaTypeAcceptsJsonSchemaType ()
234
237
{
235
- $ uriRetriever = $ this ->getMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
238
+ $ uriRetriever = $ this ->createMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
236
239
$ retriever = new UriRetriever ();
237
240
238
241
$ uriRetriever ->expects ($ this ->at (0 ))
@@ -244,7 +247,7 @@ public function testConfirmMediaTypeAcceptsJsonSchemaType()
244
247
245
248
public function testConfirmMediaTypeAcceptsJsonType ()
246
249
{
247
- $ uriRetriever = $ this ->getMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
250
+ $ uriRetriever = $ this ->createMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
248
251
$ retriever = new UriRetriever ();
249
252
250
253
$ uriRetriever ->expects ($ this ->at (0 ))
@@ -256,9 +259,8 @@ public function testConfirmMediaTypeAcceptsJsonType()
256
259
257
260
public function testConfirmMediaTypeThrowsExceptionForUnsupportedTypes ()
258
261
{
259
- $ uriRetriever = $ this ->getMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
262
+ $ uriRetriever = $ this ->createMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
260
263
$ retriever = new UriRetriever ();
261
-
262
264
$ uriRetriever ->expects ($ this ->at (0 ))
263
265
->method ('getContentType ' )
264
266
->willReturn ('text/html ' );
@@ -331,7 +333,7 @@ public function testRetrieveSchemaFromPackage()
331
333
332
334
public function testInvalidContentTypeEndpointsDefault ()
333
335
{
334
- $ mock = $ this ->getMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
336
+ $ mock = $ this ->createMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
335
337
$ mock ->method ('getContentType ' )->willReturn ('Application/X-Fake-Type ' );
336
338
$ retriever = new UriRetriever ();
337
339
@@ -341,7 +343,7 @@ public function testInvalidContentTypeEndpointsDefault()
341
343
342
344
public function testInvalidContentTypeEndpointsUnknown ()
343
345
{
344
- $ mock = $ this ->getMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
346
+ $ mock = $ this ->createMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
345
347
$ mock ->method ('getContentType ' )->willReturn ('Application/X-Fake-Type ' );
346
348
$ retriever = new UriRetriever ();
347
349
@@ -351,7 +353,7 @@ public function testInvalidContentTypeEndpointsUnknown()
351
353
352
354
public function testInvalidContentTypeEndpointsAdded ()
353
355
{
354
- $ mock = $ this ->getMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
356
+ $ mock = $ this ->createMock ('JsonSchema\Uri\Retrievers\UriRetrieverInterface ' );
355
357
$ mock ->method ('getContentType ' )->willReturn ('Application/X-Fake-Type ' );
356
358
$ retriever = new UriRetriever ();
357
359
$ retriever ->addInvalidContentTypeEndpoint ('http://example.com ' );
0 commit comments