File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
src/Symfony/Component/Form/Tests/Extension/Core/Type Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -32,4 +32,39 @@ public function testSubmitCastsToInteger()
32
32
$ this ->assertSame (1 , $ form ->getData ());
33
33
$ this ->assertSame ('1 ' , $ form ->getViewData ());
34
34
}
35
+
36
+ public function testSubmitNull ()
37
+ {
38
+ $ form = $ this ->factory ->create ('integer ' );
39
+
40
+ $ form ->submit (null );
41
+
42
+ $ this ->assertNull ($ form ->getData ());
43
+ $ this ->assertSame ('' , $ form ->getViewData ());
44
+ }
45
+
46
+ public function testSubmitNullWithEmptyData ()
47
+ {
48
+ $ form = $ this ->factory ->create ('integer ' , null , array (
49
+ 'empty_data ' => 1 ,
50
+ ));
51
+
52
+ $ form ->submit (null );
53
+
54
+ $ this ->assertSame (1 , $ form ->getData ());
55
+ $ this ->assertSame ('1 ' , $ form ->getViewData ());
56
+ }
57
+
58
+ public function testSubmitNullWithEmptyDataWhenNested ()
59
+ {
60
+ $ form = $ this ->factory ->create ('form ' )
61
+ ->add ('age ' , 'integer ' , array (
62
+ 'empty_data ' => 1 ,
63
+ ));
64
+
65
+ $ form ->submit (null );
66
+
67
+ $ this ->assertSame (1 , $ form ->get ('age ' )->getData ());
68
+ $ this ->assertSame ('1 ' , $ form ->get ('age ' )->getViewData ());
69
+ }
35
70
}
You can’t perform that action at this time.
0 commit comments