Skip to content

Commit 4a67f42

Browse files
committed
fix mock UriRetriever return value - json object instead of json string
1 parent bc9438a commit 4a67f42

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/JsonSchema/Tests/Uri/UriRetrieverTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace JsonSchema\Tests\Uri;
1111

12+
use JsonSchema\Exception\JsonDecodingException;
1213
use JsonSchema\Validator;
1314

1415
class UriRetrieverTest extends \PHPUnit_Framework_TestCase
@@ -22,12 +23,19 @@ protected function setUp()
2223

2324
private function getRetrieverMock($returnSchema, $returnMediaType = Validator::SCHEMA_MEDIA_TYPE)
2425
{
26+
27+
$jsonSchema = json_decode($returnSchema);
28+
29+
if (JSON_ERROR_NONE < $error = json_last_error()) {
30+
throw new JsonDecodingException($error);
31+
}
32+
2533
$retriever = $this->getMock('JsonSchema\Uri\UriRetriever', array('retrieve'));
2634

2735
$retriever->expects($this->at(0))
2836
->method('retrieve')
2937
->with($this->equalTo(null), $this->equalTo('http://some.host.at/somewhere/parent'))
30-
->will($this->returnValue($returnSchema));
38+
->will($this->returnValue($jsonSchema));
3139

3240
return $retriever;
3341
}

0 commit comments

Comments
 (0)