Add subset of draft-04 tests from JSON-Schema-Test-Suite.

This commit is contained in:
Michael Chiocca 2013-05-30 03:00:04 -07:00
parent 67254323e1
commit 60a0e09bc5
2 changed files with 38 additions and 0 deletions

View File

@ -92,6 +92,7 @@ class Format extends Constraint
break;
case 'ip-address':
case 'ipv4':
if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
$this->addError($path, "Invalid IP address");
}
@ -104,6 +105,7 @@ class Format extends Constraint
break;
case 'host-name':
case 'hostname':
if (!$this->validateHostname($element)) {
$this->addError($path, "Invalid hostname");
}

View File

@ -0,0 +1,36 @@
<?php
namespace JsonSchema\Tests\Drafts;
class Draft4Test extends BaseDraftTestCase
{
protected function getFilePaths()
{
return array(
realpath(__DIR__ . $this->relativeTestsRoot . '/draft4'),
realpath(__DIR__ . $this->relativeTestsRoot . '/draft4/optional')
);
}
protected function getSkippedTests()
{
return array(
// Not Yet Implemented
'allOf.json',
'anyOf.json',
'definitions.json',
'maxProperties.json',
'minProperties.json',
'multipleOf.json',
'not.json',
'oneOf.json',
// Partially Implemented
'ref.json',
'refRemote.json',
// Optional
'bignum.json',
'zeroTerminatedFloats.json'
);
}
}