Skip to content

Commit 565e7dd

Browse files
committed
Add test coverage for coercion API
1 parent 3dba977 commit 565e7dd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/Constraints/CoerciveTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ public function testInvalidCoerceCasesUsingAssoc($input, $schema, $errors = arra
116116
$this->assertFalse($validator->isValid(), print_r($validator->getErrors(), true));
117117
}
118118

119+
public function testCoerceAPI()
120+
{
121+
$input = json_decode('{"propertyOne": "10"}');
122+
$schema = json_decode('{"properties":{"propertyOne":{"type":"number"}}}');
123+
$v = new Validator();
124+
$v->coerce($input, $schema);
125+
$this->assertEquals('{"propertyOne":10}', json_encode($input));
126+
}
127+
119128
public function getValidCoerceTests()
120129
{
121130
return array(

0 commit comments

Comments
 (0)