1212namespace Symfony \Component \Form \Tests \Extension \Core \Type ;
1313
1414use Symfony \Component \Form \CallbackTransformer ;
15- use Symfony \Component \Form \Test \TypeTestCase ;
1615
17- class CheckboxTypeTest extends TypeTestCase
16+ class CheckboxTypeTest extends BaseTypeTest
1817{
18+ const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CheckboxType ' ;
19+
1920 /**
2021 * @group legacy
2122 */
@@ -28,7 +29,7 @@ public function testLegacyName()
2829
2930 public function testDataIsFalseByDefault ()
3031 {
31- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' );
32+ $ form = $ this ->factory ->create (static :: TESTED_TYPE );
3233
3334 $ this ->assertFalse ($ form ->getData ());
3435 $ this ->assertFalse ($ form ->getNormData ());
@@ -37,42 +38,42 @@ public function testDataIsFalseByDefault()
3738
3839 public function testPassValueToView ()
3940 {
40- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , null , array ('value ' => 'foobar ' ));
41- $ view = $ form ->createView ();
41+ $ view = $ this ->factory ->create (static :: TESTED_TYPE , null , array ('value ' => 'foobar ' ))
42+ ->createView ();
4243
4344 $ this ->assertEquals ('foobar ' , $ view ->vars ['value ' ]);
4445 }
4546
4647 public function testCheckedIfDataTrue ()
4748 {
48- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' );
49- $ form ->setData (true );
50- $ view = $ form ->createView ();
49+ $ view = $ this ->factory ->create (static :: TESTED_TYPE )
50+ ->setData (true )
51+ ->createView ();
5152
5253 $ this ->assertTrue ($ view ->vars ['checked ' ]);
5354 }
5455
5556 public function testCheckedIfDataTrueWithEmptyValue ()
5657 {
57- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , null , array ('value ' => '' ));
58- $ form ->setData (true );
59- $ view = $ form ->createView ();
58+ $ view = $ this ->factory ->create (static :: TESTED_TYPE , null , array ('value ' => '' ))
59+ ->setData (true )
60+ ->createView ();
6061
6162 $ this ->assertTrue ($ view ->vars ['checked ' ]);
6263 }
6364
6465 public function testNotCheckedIfDataFalse ()
6566 {
66- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' );
67- $ form ->setData (false );
68- $ view = $ form ->createView ();
67+ $ view = $ this ->factory ->create (static :: TESTED_TYPE )
68+ ->setData (false )
69+ ->createView ();
6970
7071 $ this ->assertFalse ($ view ->vars ['checked ' ]);
7172 }
7273
7374 public function testSubmitWithValueChecked ()
7475 {
75- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , null , array (
76+ $ form = $ this ->factory ->create (static :: TESTED_TYPE , null , array (
7677 'value ' => 'foobar ' ,
7778 ));
7879 $ form ->submit ('foobar ' );
@@ -83,7 +84,7 @@ public function testSubmitWithValueChecked()
8384
8485 public function testSubmitWithRandomValueChecked ()
8586 {
86- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , null , array (
87+ $ form = $ this ->factory ->create (static :: TESTED_TYPE , null , array (
8788 'value ' => 'foobar ' ,
8889 ));
8990 $ form ->submit ('krixikraxi ' );
@@ -94,7 +95,7 @@ public function testSubmitWithRandomValueChecked()
9495
9596 public function testSubmitWithValueUnchecked ()
9697 {
97- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , null , array (
98+ $ form = $ this ->factory ->create (static :: TESTED_TYPE , null , array (
9899 'value ' => 'foobar ' ,
99100 ));
100101 $ form ->submit (null );
@@ -105,7 +106,7 @@ public function testSubmitWithValueUnchecked()
105106
106107 public function testSubmitWithEmptyValueChecked ()
107108 {
108- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , null , array (
109+ $ form = $ this ->factory ->create (static :: TESTED_TYPE , null , array (
109110 'value ' => '' ,
110111 ));
111112 $ form ->submit ('' );
@@ -116,7 +117,7 @@ public function testSubmitWithEmptyValueChecked()
116117
117118 public function testSubmitWithEmptyValueUnchecked ()
118119 {
119- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , null , array (
120+ $ form = $ this ->factory ->create (static :: TESTED_TYPE , null , array (
120121 'value ' => '' ,
121122 ));
122123 $ form ->submit (null );
@@ -127,7 +128,7 @@ public function testSubmitWithEmptyValueUnchecked()
127128
128129 public function testSubmitWithEmptyValueAndFalseUnchecked ()
129130 {
130- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , null , array (
131+ $ form = $ this ->factory ->create (static :: TESTED_TYPE , null , array (
131132 'value ' => '' ,
132133 ));
133134 $ form ->submit (false );
@@ -138,7 +139,7 @@ public function testSubmitWithEmptyValueAndFalseUnchecked()
138139
139140 public function testSubmitWithEmptyValueAndTrueChecked ()
140141 {
141- $ form = $ this ->factory ->create (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , null , array (
142+ $ form = $ this ->factory ->create (static :: TESTED_TYPE , null , array (
142143 'value ' => '' ,
143144 ));
144145 $ form ->submit (true );
@@ -162,7 +163,7 @@ function ($value) {
162163 }
163164 );
164165
165- $ form = $ this ->factory ->createBuilder (' Symfony\Component\Form\Extension\Core\Type\CheckboxType ' )
166+ $ form = $ this ->factory ->createBuilder (static :: TESTED_TYPE )
166167 ->addModelTransformer ($ transformer )
167168 ->getForm ();
168169
@@ -181,4 +182,9 @@ public function provideCustomModelTransformerData()
181182 array ('unchecked ' , false ),
182183 );
183184 }
185+
186+ public function testSubmitNull ($ expected = null , $ norm = null , $ view = null )
187+ {
188+ parent ::testSubmitNull (false , false , null );
189+ }
184190}
0 commit comments