Skip to content

Commit 524853a

Browse files
committed
refactor: Replace getMock for createMock
1 parent 0753efb commit 524853a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tests/Uri/UriRetrieverTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010
namespace JsonSchema\Tests\Uri;
1111

12+
use JsonSchema\Exception\InvalidSchemaMediaTypeException;
1213
use JsonSchema\Exception\JsonDecodingException;
14+
use JsonSchema\Exception\ResourceNotFoundException;
15+
use JsonSchema\Exception\UriResolverException;
1316
use JsonSchema\Uri\UriRetriever;
1417
use JsonSchema\Validator;
1518
use PHPUnit\Framework\TestCase;
@@ -34,7 +37,7 @@ private function getRetrieverMock($returnSchema)
3437
throw new JsonDecodingException($error);
3538
}
3639

37-
$retriever = $this->getMock('JsonSchema\Uri\UriRetriever', array('retrieve'));
40+
$retriever = $this->createMock('JsonSchema\Uri\UriRetriever');
3841

3942
$retriever->expects($this->at(0))
4043
->method('retrieve')
@@ -232,7 +235,7 @@ public function testResolveExcessLevelUp()
232235

233236
public function testConfirmMediaTypeAcceptsJsonSchemaType()
234237
{
235-
$uriRetriever = $this->getMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
238+
$uriRetriever = $this->createMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
236239
$retriever = new UriRetriever();
237240

238241
$uriRetriever->expects($this->at(0))
@@ -244,7 +247,7 @@ public function testConfirmMediaTypeAcceptsJsonSchemaType()
244247

245248
public function testConfirmMediaTypeAcceptsJsonType()
246249
{
247-
$uriRetriever = $this->getMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
250+
$uriRetriever = $this->createMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
248251
$retriever = new UriRetriever();
249252

250253
$uriRetriever->expects($this->at(0))
@@ -256,9 +259,8 @@ public function testConfirmMediaTypeAcceptsJsonType()
256259

257260
public function testConfirmMediaTypeThrowsExceptionForUnsupportedTypes()
258261
{
259-
$uriRetriever = $this->getMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
262+
$uriRetriever = $this->createMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
260263
$retriever = new UriRetriever();
261-
262264
$uriRetriever->expects($this->at(0))
263265
->method('getContentType')
264266
->willReturn('text/html');
@@ -331,7 +333,7 @@ public function testRetrieveSchemaFromPackage()
331333

332334
public function testInvalidContentTypeEndpointsDefault()
333335
{
334-
$mock = $this->getMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
336+
$mock = $this->createMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
335337
$mock->method('getContentType')->willReturn('Application/X-Fake-Type');
336338
$retriever = new UriRetriever();
337339

@@ -341,7 +343,7 @@ public function testInvalidContentTypeEndpointsDefault()
341343

342344
public function testInvalidContentTypeEndpointsUnknown()
343345
{
344-
$mock = $this->getMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
346+
$mock = $this->createMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
345347
$mock->method('getContentType')->willReturn('Application/X-Fake-Type');
346348
$retriever = new UriRetriever();
347349

@@ -351,7 +353,7 @@ public function testInvalidContentTypeEndpointsUnknown()
351353

352354
public function testInvalidContentTypeEndpointsAdded()
353355
{
354-
$mock = $this->getMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
356+
$mock = $this->createMock('JsonSchema\Uri\Retrievers\UriRetrieverInterface');
355357
$mock->method('getContentType')->willReturn('Application/X-Fake-Type');
356358
$retriever = new UriRetriever();
357359
$retriever->addInvalidContentTypeEndpoint('http://example.com');

0 commit comments

Comments
 (0)