Skip to content

Commit 853eb09

Browse files
Add tests for boolean coercion
1 parent 8c3ee91 commit 853eb09

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/Constraints/CoerciveTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,27 @@ public function dataCoerceCases()
144144
'string', 'integer', 42, true
145145
);
146146

147+
// #48 check boolean coercion with "const"
148+
$tests[] = array(
149+
'{"properties":{"propertyOne":{"type":"boolean","const":false}}}',
150+
'{"propertyOne":"false"}',
151+
'string', 'boolean', false, true
152+
);
153+
154+
// #49 check boolean coercion with "const"
155+
$tests[] = array(
156+
'{"properties":{"propertyOne":{"type":"boolean","const":true}}}',
157+
'{"propertyOne":"true"}',
158+
'string', 'boolean', true, true
159+
);
160+
161+
// #50 check boolean coercion with "const"
162+
$tests[] = array(
163+
'{"properties":{"propertyOne":{"type":"boolean","const":true}}}',
164+
'{"propertyOne":1}',
165+
'integer', 'boolean', true, true
166+
);
167+
147168
foreach ($types as $toType => $testCases) {
148169
foreach ($testCases as $testCase) {
149170
$tests[] = array(

0 commit comments

Comments
 (0)