@@ -672,6 +672,66 @@ public function testSubmitSingleNonExpandedObjectChoices()
672
672
$ this ->assertTrue ($ form ->isSynchronized ());
673
673
}
674
674
675
+ public function testSubmitSingleChoiceWithEmptyData ()
676
+ {
677
+ $ form = $ this ->factory ->create ('choice ' , null , array (
678
+ 'multiple ' => false ,
679
+ 'expanded ' => false ,
680
+ 'choices ' => array ('test ' ),
681
+ 'choices_as_values ' => true ,
682
+ 'empty_data ' => 'test ' ,
683
+ ));
684
+
685
+ $ form ->submit (null );
686
+
687
+ $ this ->assertSame ('test ' , $ form ->getData ());
688
+ }
689
+
690
+ public function testSubmitMultipleChoiceWithEmptyData ()
691
+ {
692
+ $ form = $ this ->factory ->create ('choice ' , null , array (
693
+ 'multiple ' => true ,
694
+ 'expanded ' => false ,
695
+ 'choices ' => array ('test ' ),
696
+ 'choices_as_values ' => true ,
697
+ 'empty_data ' => array ('test ' ),
698
+ ));
699
+
700
+ $ form ->submit (null );
701
+
702
+ $ this ->assertSame (array ('test ' ), $ form ->getData ());
703
+ }
704
+
705
+ public function testSubmitSingleChoiceExpandedWithEmptyData ()
706
+ {
707
+ $ form = $ this ->factory ->create ('choice ' , null , array (
708
+ 'multiple ' => false ,
709
+ 'expanded ' => true ,
710
+ 'choices ' => array ('test ' ),
711
+ 'choices_as_values ' => true ,
712
+ 'empty_data ' => 'test ' ,
713
+ ));
714
+
715
+ $ form ->submit (null );
716
+
717
+ $ this ->assertSame ('test ' , $ form ->getData ());
718
+ }
719
+
720
+ public function testSubmitMultipleChoiceExpandedWithEmptyData ()
721
+ {
722
+ $ form = $ this ->factory ->create ('choice ' , null , array (
723
+ 'multiple ' => true ,
724
+ 'expanded ' => true ,
725
+ 'choices ' => array ('test ' ),
726
+ 'choices_as_values ' => true ,
727
+ 'empty_data ' => array ('test ' ),
728
+ ));
729
+
730
+ $ form ->submit (null );
731
+
732
+ $ this ->assertSame (array ('test ' ), $ form ->getData ());
733
+ }
734
+
675
735
/**
676
736
* @group legacy
677
737
*/
0 commit comments