@@ -916,17 +916,18 @@ public function ofScalarsWithMeaninglessKeys()
916916 */
917917 public function ofScalarsFail ()
918918 {
919+ $ valueOne = '1 ' ;
920+ $ valueTwo = [];
921+ $ valueThree = new stdClass ();
919922 try {
920- Filterer::ofScalars ([' 1 ' , [], new stdClass ], [['string ' ]]);
923+ Filterer::ofScalars ([$ valueOne , $ valueTwo , $ valueThree ], [['string ' ]]);
921924 $ this ->fail ();
922925 } catch (FilterException $ e ) {
926+ $ valueTwoExport = var_export ($ valueTwo , true );
927+ $ valueThreeExport = var_export ($ valueThree , true );
923928 $ expected = <<<TXT
924- Field '1' with value 'array (
925- )' failed filtering, message 'Value 'array (
926- )' is not a string'
927- Field '2' with value 'stdClass::__set_state(array(
928- ))' failed filtering, message 'Value 'stdClass::__set_state(array(
929- ))' is not a string'
929+ Field '1' with value ' {$ valueTwoExport }' failed filtering, message 'Value ' {$ valueTwoExport }' is not a string'
930+ Field '2' with value ' {$ valueThreeExport }' failed filtering, message 'Value ' {$ valueThreeExport }' is not a string'
930931TXT ;
931932 $ this ->assertSame ($ expected , $ e ->getMessage ());
932933 }
@@ -974,20 +975,22 @@ public function ofArraysRequiredAndUnknown()
974975 */
975976 public function ofArraysFail ()
976977 {
978+ $ valueOne = new stdClass ();
979+ $ valueTwo = [];
980+ $ valueThree = null ;
981+ $ valueFour = 'key ' ;
977982 try {
978983 Filterer::ofArrays (
979- [['key ' => new stdClass ], ['key ' => []] , ['key ' => null ], ' key ' ],
984+ [['key ' => $ valueOne ], ['key ' => $ valueTwo ] , ['key ' => $ valueThree ], $ valueFour ],
980985 ['key ' => [['string ' ]]]
981986 );
982987 $ this ->fail ();
983988 } catch (FilterException $ e ) {
989+ $ valueOneExport = var_export ($ valueOne , true );
990+ $ valueTwoExport = var_export ($ valueTwo , true );
984991 $ expected = <<<TXT
985- Field 'key' with value 'stdClass::__set_state(array(
986- ))' failed filtering, message 'Value 'stdClass::__set_state(array(
987- ))' is not a string'
988- Field 'key' with value 'array (
989- )' failed filtering, message 'Value 'array (
990- )' is not a string'
992+ Field 'key' with value ' {$ valueOneExport }' failed filtering, message 'Value ' {$ valueOneExport }' is not a string'
993+ Field 'key' with value ' {$ valueTwoExport }' failed filtering, message 'Value ' {$ valueTwoExport }' is not a string'
991994Field 'key' with value 'NULL' failed filtering, message 'Value failed filtering, \$allowNull is set to false'
992995Value at position '3' was not an array
993996TXT ;
0 commit comments