Skip to content

Commit

Permalink
Add tests for boolean coercion
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-helmich committed Apr 17, 2018
1 parent 8c3ee91 commit 853eb09
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/Constraints/CoerciveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,27 @@ public function dataCoerceCases()
'string', 'integer', 42, true
);

// #48 check boolean coercion with "const"
$tests[] = array(
'{"properties":{"propertyOne":{"type":"boolean","const":false}}}',
'{"propertyOne":"false"}',
'string', 'boolean', false, true
);

// #49 check boolean coercion with "const"
$tests[] = array(
'{"properties":{"propertyOne":{"type":"boolean","const":true}}}',
'{"propertyOne":"true"}',
'string', 'boolean', true, true
);

// #50 check boolean coercion with "const"
$tests[] = array(
'{"properties":{"propertyOne":{"type":"boolean","const":true}}}',
'{"propertyOne":1}',
'integer', 'boolean', true, true
);

foreach ($types as $toType => $testCases) {
foreach ($testCases as $testCase) {
$tests[] = array(
Expand Down

0 comments on commit 853eb09

Please sign in to comment.