99
1010namespace JsonSchema \Tests \Constraints ;
1111
12+ use JsonSchema \RefResolver ;
13+ use JsonSchema \Uri \UriRetriever ;
1214use JsonSchema \Validator ;
1315
1416abstract 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+ }
0 commit comments