Skip to content

Commit 60a0e09

Browse files
author
Michael Chiocca
committed
Add subset of draft-04 tests from JSON-Schema-Test-Suite.
1 parent 6725432 commit 60a0e09

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/JsonSchema/Constraints/Format.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function check($element, $schema = null, $path = null, $i = null)
9292
break;
9393

9494
case 'ip-address':
95+
case 'ipv4':
9596
if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
9697
$this->addError($path, "Invalid IP address");
9798
}
@@ -104,6 +105,7 @@ public function check($element, $schema = null, $path = null, $i = null)
104105
break;
105106

106107
case 'host-name':
108+
case 'hostname':
107109
if (!$this->validateHostname($element)) {
108110
$this->addError($path, "Invalid hostname");
109111
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace JsonSchema\Tests\Drafts;
4+
5+
class Draft4Test extends BaseDraftTestCase
6+
{
7+
protected function getFilePaths()
8+
{
9+
return array(
10+
realpath(__DIR__ . $this->relativeTestsRoot . '/draft4'),
11+
realpath(__DIR__ . $this->relativeTestsRoot . '/draft4/optional')
12+
);
13+
}
14+
15+
protected function getSkippedTests()
16+
{
17+
return array(
18+
// Not Yet Implemented
19+
'allOf.json',
20+
'anyOf.json',
21+
'definitions.json',
22+
'maxProperties.json',
23+
'minProperties.json',
24+
'multipleOf.json',
25+
'not.json',
26+
'oneOf.json',
27+
// Partially Implemented
28+
'ref.json',
29+
'refRemote.json',
30+
// Optional
31+
'bignum.json',
32+
'zeroTerminatedFloats.json'
33+
);
34+
}
35+
36+
}

0 commit comments

Comments
 (0)