Skip to content

Commit 3140166

Browse files
committed
add unit tests to validate issue #102
1 parent d97cf3c commit 3140166

File tree

1 file changed

+68
-2
lines changed

1 file changed

+68
-2
lines changed

tests/JsonSchema/Tests/Constraints/RequiredPropertyTest.php

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,40 @@ public function getInvalidTests()
144144
"null":{"type":"null", "required": true}
145145
}
146146
}'
147-
)
147+
),
148+
array(
149+
'{
150+
"foo": {"baz": 1.5}
151+
}',
152+
'{
153+
"type": "object",
154+
"properties": {
155+
"foo": {
156+
"type": "object",
157+
"properties": {
158+
"bar": {"type": "number"}
159+
},
160+
"required": ["bar"]
161+
}
162+
}
163+
}'
164+
),
165+
array(
166+
'{
167+
"foo": {"baz": 1.5}
168+
}',
169+
'{
170+
"type": "object",
171+
"properties": {
172+
"foo": {
173+
"type": "object",
174+
"properties": {
175+
"bar": {"type": "number", "required": true}
176+
}
177+
}
178+
}
179+
}'
180+
),
148181
);
149182
}
150183

@@ -266,7 +299,40 @@ public function getValidTests()
266299
"foo": { "required": true }
267300
}
268301
}'
269-
)
302+
),
303+
array(
304+
'{
305+
"boo": {"bar": 1.5}
306+
}',
307+
'{
308+
"type": "object",
309+
"properties": {
310+
"foo": {
311+
"type": "object",
312+
"properties": {
313+
"bar": {"type": "number"}
314+
},
315+
"required": ["bar"]
316+
}
317+
}
318+
}'
319+
),
320+
array(
321+
'{
322+
"boo": {"bar": 1.5}
323+
}',
324+
'{
325+
"type": "object",
326+
"properties": {
327+
"foo": {
328+
"type": "object",
329+
"properties": {
330+
"bar": {"type": "number", "required": true}
331+
}
332+
}
333+
}
334+
}'
335+
),
270336
);
271337
}
272338
}

0 commit comments

Comments
 (0)