Skip to content

Commit

Permalink
Add test cases for coercive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-helmich committed Apr 17, 2018
1 parent 6d04026 commit 789c97e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/Constraints/CoerciveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,20 @@ public function dataCoerceCases()
'string', 'integer', 42, true
);

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

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

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

0 comments on commit 789c97e

Please sign in to comment.