Skip to content

Commit 4ce936a

Browse files
author
Andy Raines
committed
Alter tests so that we actually resolve references
1 parent 34ca930 commit 4ce936a

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

tests/JsonSchema/Tests/Constraints/BaseTestCase.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace JsonSchema\Tests\Constraints;
1111

12+
use JsonSchema\RefResolver;
13+
use JsonSchema\Uri\UriRetriever;
1214
use JsonSchema\Validator;
1315

1416
abstract class BaseTestCase extends \PHPUnit_Framework_TestCase
@@ -18,9 +20,14 @@ abstract class BaseTestCase extends \PHPUnit_Framework_TestCase
1820
*/
1921
public function testInvalidCases($input, $schema, $checkMode = Validator::CHECK_MODE_NORMAL, $errors = array())
2022
{
23+
$schema = json_decode($schema);
24+
25+
$refResolver = new RefResolver(new UriRetriever);
26+
$refResolver->resolve($schema);
27+
2128
$validator = new Validator($checkMode);
2229

23-
$validator->check(json_decode($input), json_decode($schema));
30+
$validator->check(json_decode($input), $schema);
2431

2532
if (array() !== $errors) {
2633
$this->assertEquals($errors, $validator->getErrors(), print_r($validator->getErrors(),true));
@@ -33,13 +40,18 @@ public function testInvalidCases($input, $schema, $checkMode = Validator::CHECK_
3340
*/
3441
public function testValidCases($input, $schema, $checkMode = Validator::CHECK_MODE_NORMAL)
3542
{
43+
$schema = json_decode($schema);
44+
45+
$refResolver = new RefResolver(new UriRetriever);
46+
$refResolver->resolve($schema);
47+
3648
$validator = new Validator($checkMode);
3749

38-
$validator->check(json_decode($input), json_decode($schema));
50+
$validator->check(json_decode($input), $schema);
3951
$this->assertTrue($validator->isValid(), print_r($validator->getErrors(), true));
4052
}
4153

4254
abstract public function getValidTests();
4355

4456
abstract public function getInvalidTests();
45-
}
57+
}

tests/JsonSchema/Tests/Drafts/Draft4Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ protected function getSkippedTests()
1818
// Not Yet Implemented
1919
'definitions.json',
2020
// Partially Implemented
21-
'ref.json',
21+
//'ref.json',
2222
'refRemote.json',
2323
// Optional
2424
'bignum.json',
2525
'zeroTerminatedFloats.json'
2626
);
2727
}
2828

29-
}
29+
}

0 commit comments

Comments
 (0)