diff --git a/bootstrap.php b/bootstrap.php new file mode 100644 index 0000000..aa28ace --- /dev/null +++ b/bootstrap.php @@ -0,0 +1,5 @@ + + + + + + tests + + + diff --git a/tests/AdditionalPropertiesTest.php b/tests/AdditionalPropertiesTest.php new file mode 100644 index 0000000..ecc3cd0 --- /dev/null +++ b/tests/AdditionalPropertiesTest.php @@ -0,0 +1,67 @@ +assertEquals($errors, $result->errors); + } + $this->assertFalse($result->valid, var_export($result, true)); + } + + /** + * @dataProvider getValidTests + */ + public function testValidCases($input, $schema, $checkMode = null) + { + if (null === $checkMode) { + $checkMode = JsonSchema::CHECK_MODE_NORMAL; + } + JsonSchema::$checkMode = $checkMode; + $result = JsonSchema::validate(json_decode($input), json_decode($schema)); + $this->assertTrue($result->valid, var_export($result, true)); + } + + abstract public function getValidTests(); + + abstract public function getInvalidTests(); +} \ No newline at end of file diff --git a/tests/BasicTypesTest.php b/tests/BasicTypesTest.php new file mode 100644 index 0000000..2902629 --- /dev/null +++ b/tests/BasicTypesTest.php @@ -0,0 +1,78 @@ +