@@ -875,24 +875,17 @@ public function testGetErrorsDeep()
875875 $ this ->assertSame (
876876 "ERROR: Error 1 \n" .
877877 "ERROR: Error 2 \n" .
878- "Child: \n" .
879- " ERROR: Nested Error \n" ,
878+ "ERROR: Nested Error \n" ,
880879 (string ) $ errors
881880 );
882881
883- $ errorsAsArray = iterator_to_array ($ errors );
884-
885- $ this ->assertSame ($ error1 , $ errorsAsArray [0 ]);
886- $ this ->assertSame ($ error2 , $ errorsAsArray [1 ]);
887- $ this ->assertInstanceOf ('Symfony\Component\Form\FormErrorIterator ' , $ errorsAsArray [2 ]);
888-
889- $ nestedErrorsAsArray = iterator_to_array ($ errorsAsArray [2 ]);
890-
891- $ this ->assertCount (1 , $ nestedErrorsAsArray );
892- $ this ->assertSame ($ nestedError , $ nestedErrorsAsArray [0 ]);
882+ $ this ->assertSame (
883+ array ($ error1 , $ error2 , $ nestedError ),
884+ iterator_to_array ($ errors )
885+ );
893886 }
894887
895- public function testGetErrorsDeepFlat ()
888+ public function testGetErrorsDeepRecursive ()
896889 {
897890 $ this ->form ->addError ($ error1 = new FormError ('Error 1 ' ));
898891 $ this ->form ->addError ($ error2 = new FormError ('Error 2 ' ));
@@ -901,19 +894,26 @@ public function testGetErrorsDeepFlat()
901894 $ childForm ->addError ($ nestedError = new FormError ('Nested Error ' ));
902895 $ this ->form ->add ($ childForm );
903896
904- $ errors = $ this ->form ->getErrors (true , true );
897+ $ errors = $ this ->form ->getErrors (true , false );
905898
906899 $ this ->assertSame (
907900 "ERROR: Error 1 \n" .
908901 "ERROR: Error 2 \n" .
909- "ERROR: Nested Error \n" ,
902+ "Child: \n" .
903+ " ERROR: Nested Error \n" ,
910904 (string ) $ errors
911905 );
912906
913- $ this ->assertSame (
914- array ($ error1 , $ error2 , $ nestedError ),
915- iterator_to_array ($ errors )
916- );
907+ $ errorsAsArray = iterator_to_array ($ errors );
908+
909+ $ this ->assertSame ($ error1 , $ errorsAsArray [0 ]);
910+ $ this ->assertSame ($ error2 , $ errorsAsArray [1 ]);
911+ $ this ->assertInstanceOf ('Symfony\Component\Form\FormErrorIterator ' , $ errorsAsArray [2 ]);
912+
913+ $ nestedErrorsAsArray = iterator_to_array ($ errorsAsArray [2 ]);
914+
915+ $ this ->assertCount (1 , $ nestedErrorsAsArray );
916+ $ this ->assertSame ($ nestedError , $ nestedErrorsAsArray [0 ]);
917917 }
918918
919919 // Basic cases are covered in SimpleFormTest
0 commit comments