@@ -172,11 +172,17 @@ public function ofScalarsWithMeaninglessKeys()
172172 public function ofScalarsFail ()
173173 {
174174 try {
175- Arrays::ofScalars (['1 ' , 2 , 3 ], [['string ' ]]);
175+ Arrays::ofScalars (['1 ' , [], new \ StdClass ], [['string ' ]]);
176176 $ this ->fail ();
177177 } catch (\Exception $ e ) {
178- $ expected = "Field '1' with value '2' failed filtering, message 'Value '2' is not a string' \n" ;
179- $ expected .= "Field '2' with value '3' failed filtering, message 'Value '3' is not a string' " ;
178+ $ expected = <<<TXT
179+ Field '1' with value 'array (
180+ )' failed filtering, message 'Value 'array (
181+ )' is not a string'
182+ Field '2' with value 'stdClass::__set_state(array(
183+ ))' failed filtering, message 'Value 'stdClass::__set_state(array(
184+ ))' is not a string'
185+ TXT ;
180186 $ this ->assertSame ($ expected , $ e ->getMessage ());
181187 }
182188 }
@@ -224,12 +230,22 @@ public function ofArraysRequiredAndUnknown()
224230 public function ofArraysFail ()
225231 {
226232 try {
227- Arrays::ofArrays ([['key ' => '1 ' ], ['key ' => 2 ], ['key ' => 3 ], 'key ' ], ['key ' => [['string ' ]]]);
233+ Arrays::ofArrays (
234+ [['key ' => new \StdClass ], ['key ' => []], ['key ' => null ], 'key ' ],
235+ ['key ' => [['string ' ]]]
236+ );
228237 $ this ->fail ();
229238 } catch (\Exception $ e ) {
230- $ expected = "Field 'key' with value '2' failed filtering, message 'Value '2' is not a string' \n" ;
231- $ expected .= "Field 'key' with value '3' failed filtering, message 'Value '3' is not a string' \n" ;
232- $ expected .= "Value at position '3' was not an array " ;
239+ $ expected = <<<TXT
240+ Field 'key' with value 'stdClass::__set_state(array(
241+ ))' failed filtering, message 'Value 'stdClass::__set_state(array(
242+ ))' is not a string'
243+ Field 'key' with value 'array (
244+ )' failed filtering, message 'Value 'array (
245+ )' is not a string'
246+ Field 'key' with value 'NULL' failed filtering, message 'Value 'NULL' is not a string'
247+ Value at position '3' was not an array
248+ TXT ;
233249 $ this ->assertSame ($ expected , $ e ->getMessage ());
234250 }
235251 }
0 commit comments