Skip to content

Commit 789c97e

Browse files
Add test cases for coercive mode
1 parent 6d04026 commit 789c97e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/Constraints/CoerciveTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,20 @@ public function dataCoerceCases()
130130
'string', 'integer', 42, true
131131
);
132132

133-
$tests = array();
133+
// #46 check coercion with "const"
134+
$tests[] = array(
135+
'{"properties":{"propertyOne":{"type":"string","const":"42"}}}',
136+
'{"propertyOne":42}',
137+
'integer', 'string', "42", true
138+
);
139+
140+
// #46 check coercion with "const"
141+
$tests[] = array(
142+
'{"properties":{"propertyOne":{"type":"number","const":42}}}',
143+
'{"propertyOne":"42"}',
144+
'string', 'integer', 42, true
145+
);
146+
134147
foreach ($types as $toType => $testCases) {
135148
foreach ($testCases as $testCase) {
136149
$tests[] = array(

0 commit comments

Comments
 (0)