@@ -875,24 +875,17 @@ public function testGetErrorsDeep()
875
875
$ this ->assertSame (
876
876
"ERROR: Error 1 \n" .
877
877
"ERROR: Error 2 \n" .
878
- "Child: \n" .
879
- " ERROR: Nested Error \n" ,
878
+ "ERROR: Nested Error \n" ,
880
879
(string ) $ errors
881
880
);
882
881
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
+ );
893
886
}
894
887
895
- public function testGetErrorsDeepFlat ()
888
+ public function testGetErrorsDeepRecursive ()
896
889
{
897
890
$ this ->form ->addError ($ error1 = new FormError ('Error 1 ' ));
898
891
$ this ->form ->addError ($ error2 = new FormError ('Error 2 ' ));
@@ -901,19 +894,26 @@ public function testGetErrorsDeepFlat()
901
894
$ childForm ->addError ($ nestedError = new FormError ('Nested Error ' ));
902
895
$ this ->form ->add ($ childForm );
903
896
904
- $ errors = $ this ->form ->getErrors (true , true );
897
+ $ errors = $ this ->form ->getErrors (true , false );
905
898
906
899
$ this ->assertSame (
907
900
"ERROR: Error 1 \n" .
908
901
"ERROR: Error 2 \n" .
909
- "ERROR: Nested Error \n" ,
902
+ "Child: \n" .
903
+ " ERROR: Nested Error \n" ,
910
904
(string ) $ errors
911
905
);
912
906
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 ]);
917
917
}
918
918
919
919
// Basic cases are covered in SimpleFormTest
0 commit comments