@@ -68,6 +68,8 @@ public function testValidCoerceCases($input, $schema, $errors = array())
68
68
$ this ->assertTrue (gettype ($ value ->numberArray ) == 'integer ' );
69
69
$ this ->assertTrue (gettype ($ value ->boolArray ) == 'boolean ' );
70
70
$ this ->assertTrue (gettype ($ value ->nullArray ) == 'NULL ' );
71
+ $ this ->assertTrue (gettype ($ value ->doubleCoercion ) == 'array ' );
72
+ $ this ->assertTrue (gettype ($ value ->doubleCoercion2 ) == 'integer ' );
71
73
72
74
$ validator ->validate ($ value , $ schema , $ checkMode );
73
75
@@ -91,6 +93,8 @@ public function testValidCoerceCases($input, $schema, $errors = array())
91
93
$ this ->assertTrue (gettype ($ value ->numberArray ) == 'array ' );
92
94
$ this ->assertTrue (gettype ($ value ->boolArray ) == 'array ' );
93
95
$ this ->assertTrue (gettype ($ value ->nullArray ) == 'array ' );
96
+ $ this ->assertTrue (gettype ($ value ->doubleCoercion ) == 'integer ' );
97
+ $ this ->assertTrue (gettype ($ value ->doubleCoercion2 ) == 'array ' );
94
98
95
99
$ this ->assertTrue (gettype ($ value ->multitype1 ) == 'boolean ' );
96
100
$ this ->assertTrue (gettype ($ value ->multitype2 ) == 'double ' );
@@ -117,6 +121,8 @@ public function testValidCoerceCases($input, $schema, $errors = array())
117
121
$ this ->assertTrue ($ value ->numberArray === array (45 ));
118
122
$ this ->assertTrue ($ value ->boolArray === array (true ));
119
123
$ this ->assertTrue ($ value ->nullArray === array (null ));
124
+ $ this ->assertTrue ($ value ->doubleCoercion === 45 );
125
+ $ this ->assertTrue ($ value ->doubleCoercion2 === array ('45 ' ));
120
126
121
127
$ this ->assertTrue ($ validator ->isValid (), print_r ($ validator ->getErrors (), true ));
122
128
}
@@ -187,6 +193,8 @@ public function getValidCoerceTests()
187
193
"numberArray":45,
188
194
"boolArray":true,
189
195
"nullArray":null,
196
+ "doubleCoercion":["45"],
197
+ "doubleCoercion2":45,
190
198
"null":null,
191
199
"any": "string",
192
200
"allOf": "1",
@@ -227,6 +235,8 @@ public function getValidCoerceTests()
227
235
"numberArray":{"type":"array"},
228
236
"boolArray":{"type":"array"},
229
237
"nullArray":{"type":"array"},
238
+ "doubleCoercion":{"type":"number"},
239
+ "doubleCoercion2":{"type":"array","items":[{"type":"string"}]},
230
240
"null":{"type":"null"},
231
241
"any": {"type":"any"},
232
242
"allOf" : {"allOf":[{
0 commit comments