@@ -70,6 +70,8 @@ public function testValidCoerceCases($input, $schema, $errors = array())
70
70
$ this ->assertTrue (gettype ($ value ->nullArray ) == 'NULL ' );
71
71
$ this ->assertTrue (gettype ($ value ->doubleCoercion ) == 'array ' );
72
72
$ this ->assertTrue (gettype ($ value ->doubleCoercion2 ) == 'integer ' );
73
+ $ this ->assertTrue (gettype ($ value ->doubleCoercion3 ) == 'integer ' );
74
+ $ this ->assertTrue (gettype ($ value ->doubleCoercion4 ) == 'integer ' );
73
75
74
76
$ validator ->validate ($ value , $ schema , $ checkMode );
75
77
@@ -95,6 +97,8 @@ public function testValidCoerceCases($input, $schema, $errors = array())
95
97
$ this ->assertTrue (gettype ($ value ->nullArray ) == 'array ' );
96
98
$ this ->assertTrue (gettype ($ value ->doubleCoercion ) == 'integer ' );
97
99
$ this ->assertTrue (gettype ($ value ->doubleCoercion2 ) == 'array ' );
100
+ $ this ->assertTrue (gettype ($ value ->doubleCoercion3 ) == 'array ' );
101
+ $ this ->assertTrue (gettype ($ value ->doubleCoercion4 ) == 'string ' );
98
102
99
103
$ this ->assertTrue (gettype ($ value ->multitype1 ) == 'boolean ' );
100
104
$ this ->assertTrue (gettype ($ value ->multitype2 ) == 'double ' );
@@ -123,6 +127,8 @@ public function testValidCoerceCases($input, $schema, $errors = array())
123
127
$ this ->assertTrue ($ value ->nullArray === array (null ));
124
128
$ this ->assertTrue ($ value ->doubleCoercion === 45 );
125
129
$ this ->assertTrue ($ value ->doubleCoercion2 === array ('45 ' ));
130
+ $ this ->assertTrue ($ value ->doubleCoercion3 === array ('45 ' ));
131
+ $ this ->assertTrue ($ value ->doubleCoercion4 === '45 ' );
126
132
127
133
$ this ->assertTrue ($ validator ->isValid (), print_r ($ validator ->getErrors (), true ));
128
134
}
@@ -195,6 +201,8 @@ public function getValidCoerceTests()
195
201
"nullArray":null,
196
202
"doubleCoercion":["45"],
197
203
"doubleCoercion2":45,
204
+ "doubleCoercion3":45,
205
+ "doubleCoercion4":45,
198
206
"null":null,
199
207
"any": "string",
200
208
"allOf": "1",
@@ -237,6 +245,8 @@ public function getValidCoerceTests()
237
245
"nullArray":{"type":"array"},
238
246
"doubleCoercion":{"type":"number"},
239
247
"doubleCoercion2":{"type":"array","items":[{"type":"string"}]},
248
+ "doubleCoercion3":{"anyOf":[{"type":"array","items":[{"type":"string"}]},{"type":"number"}]},
249
+ "doubleCoercion4":{"anyOf":[{"type":"array","items":[{"type":"object"}]},{"type":"string"}]},
240
250
"null":{"type":"null"},
241
251
"any": {"type":"any"},
242
252
"allOf" : {"allOf":[{
0 commit comments