@@ -512,6 +512,16 @@ public function testOverrideErrorBubbling()
512
512
$ this ->assertTrue ($ form ->getConfig ()->getErrorBubbling ());
513
513
}
514
514
515
+ public function testErrorBubblingForCompoundFieldsIsDisabledByDefaultIfInheritDataIsEnabled ()
516
+ {
517
+ $ form = $ this ->factory ->create (static ::TESTED_TYPE , null , [
518
+ 'compound ' => true ,
519
+ 'inherit_data ' => true ,
520
+ ]);
521
+
522
+ $ this ->assertFalse ($ form ->getConfig ()->getErrorBubbling ());
523
+ }
524
+
515
525
public function testPropertyPath ()
516
526
{
517
527
$ form = $ this ->factory ->create (static ::TESTED_TYPE , null , [
@@ -729,6 +739,28 @@ public function testPreferOwnHelpTranslationParameters()
729
739
730
740
$ this ->assertEquals (['%parent_param% ' => 'parent_value ' , '%override_param% ' => 'child_value ' ], $ view ['child ' ]->vars ['help_translation_parameters ' ]);
731
741
}
742
+
743
+ public function testErrorBubblingDoesNotSkipCompoundFieldsWithInheritDataConfigured ()
744
+ {
745
+ $ form = $ this ->factory ->createNamedBuilder ('form ' , self ::TESTED_TYPE )
746
+ ->add (
747
+ $ this ->factory ->createNamedBuilder ('inherit_data_type ' , self ::TESTED_TYPE , null , [
748
+ 'inherit_data ' => true ,
749
+ ])
750
+ ->add ('child ' , self ::TESTED_TYPE , [
751
+ 'compound ' => false ,
752
+ 'error_bubbling ' => true ,
753
+ ])
754
+ )
755
+ ->getForm ();
756
+ $ error = new FormError ('error message ' );
757
+ $ form ->get ('inherit_data_type ' )->get ('child ' )->addError ($ error );
758
+
759
+ $ this ->assertCount (0 , $ form ->getErrors ());
760
+ $ this ->assertCount (1 , $ form ->get ('inherit_data_type ' )->getErrors ());
761
+ $ this ->assertSame ($ error , $ form ->get ('inherit_data_type ' )->getErrors ()[0 ]);
762
+ $ this ->assertCount (0 , $ form ->get ('inherit_data_type ' )->get ('child ' )->getErrors ());
763
+ }
732
764
}
733
765
734
766
class Money
0 commit comments