@@ -36,7 +36,9 @@ public function testLabelOnForm()
36
36
37
37
public function testLabelDoesNotRenderFieldAttributes ()
38
38
{
39
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' );
39
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
40
+ 'empty_data ' => null ,
41
+ ]);
40
42
$ html = $ this ->renderLabel ($ form ->createView (), null , [
41
43
'attr ' => [
42
44
'class ' => 'my&class ' ,
@@ -53,7 +55,9 @@ public function testLabelDoesNotRenderFieldAttributes()
53
55
54
56
public function testLabelWithCustomAttributesPassedDirectly ()
55
57
{
56
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' );
58
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
59
+ 'empty_data ' => null ,
60
+ ]);
57
61
$ html = $ this ->renderLabel ($ form ->createView (), null , [
58
62
'label_attr ' => [
59
63
'class ' => 'my&class ' ,
@@ -70,7 +74,9 @@ public function testLabelWithCustomAttributesPassedDirectly()
70
74
71
75
public function testLabelWithCustomTextAndCustomAttributesPassedDirectly ()
72
76
{
73
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' );
77
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
78
+ 'empty_data ' => null ,
79
+ ]);
74
80
$ html = $ this ->renderLabel ($ form ->createView (), 'Custom label ' , [
75
81
'label_attr ' => [
76
82
'class ' => 'my&class ' ,
@@ -89,6 +95,7 @@ public function testLabelWithCustomTextAndCustomAttributesPassedDirectly()
89
95
public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly ()
90
96
{
91
97
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
98
+ 'empty_data ' => null ,
92
99
'label ' => 'Custom label ' ,
93
100
]);
94
101
$ html = $ this ->renderLabel ($ form ->createView (), null , [
@@ -109,6 +116,7 @@ public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly
109
116
public function testLabelHtmlDefaultIsFalse ()
110
117
{
111
118
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
119
+ 'empty_data ' => null ,
112
120
'label ' => '<b>Bolded label</b> ' ,
113
121
]);
114
122
@@ -125,6 +133,7 @@ public function testLabelHtmlDefaultIsFalse()
125
133
public function testLabelHtmlIsTrue ()
126
134
{
127
135
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
136
+ 'empty_data ' => null ,
128
137
'label ' => '<b>Bolded label</b> ' ,
129
138
'label_html ' => true ,
130
139
]);
@@ -142,6 +151,7 @@ public function testLabelHtmlIsTrue()
142
151
public function testHelp ()
143
152
{
144
153
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
154
+ 'empty_data ' => null ,
145
155
'help ' => 'Help text test! ' ,
146
156
]);
147
157
$ view = $ form ->createView ();
@@ -159,6 +169,7 @@ public function testHelp()
159
169
public function testHelpAttr ()
160
170
{
161
171
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
172
+ 'empty_data ' => null ,
162
173
'help ' => 'Help text test! ' ,
163
174
'help_attr ' => [
164
175
'class ' => 'class-test ' ,
@@ -179,6 +190,7 @@ public function testHelpAttr()
179
190
public function testHelpHtmlDefaultIsFalse ()
180
191
{
181
192
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
193
+ 'empty_data ' => null ,
182
194
'help ' => 'Help <b>text</b> test! ' ,
183
195
]);
184
196
@@ -206,6 +218,7 @@ public function testHelpHtmlDefaultIsFalse()
206
218
public function testHelpHtmlIsFalse ()
207
219
{
208
220
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
221
+ 'empty_data ' => null ,
209
222
'help ' => 'Help <b>text</b> test! ' ,
210
223
'help_html ' => false ,
211
224
]);
@@ -234,6 +247,7 @@ public function testHelpHtmlIsFalse()
234
247
public function testHelpHtmlIsTrue ()
235
248
{
236
249
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
250
+ 'empty_data ' => null ,
237
251
'help ' => 'Help <b>text</b> test! ' ,
238
252
'help_html ' => true ,
239
253
]);
@@ -261,7 +275,9 @@ public function testHelpHtmlIsTrue()
261
275
262
276
public function testErrors ()
263
277
{
264
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' );
278
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
279
+ 'empty_data ' => null ,
280
+ ]);
265
281
$ form ->addError (new FormError ('[trans]Error 1[/trans] ' ));
266
282
$ form ->addError (new FormError ('[trans]Error 2[/trans] ' ));
267
283
$ view = $ form ->createView ();
@@ -294,7 +310,9 @@ public function testErrors()
294
310
public function testOverrideWidgetBlock ()
295
311
{
296
312
// see custom_widgets.html.twig
297
- $ form = $ this ->factory ->createNamed ('text_id ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' );
313
+ $ form = $ this ->factory ->createNamed ('text_id ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
314
+ 'empty_data ' => null ,
315
+ ]);
298
316
$ html = $ this ->renderWidget ($ form ->createView ());
299
317
300
318
$ this ->assertMatchesXpath ($ html ,
@@ -1972,7 +1990,9 @@ public function testBirthDayWithPlaceholder()
1972
1990
1973
1991
public function testEmail ()
1974
1992
{
1975
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\EmailType ' , 'foo&bar ' );
1993
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\EmailType ' , 'foo&bar ' , [
1994
+ 'empty_data ' => null ,
1995
+ ]);
1976
1996
1977
1997
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
1978
1998
'/input
@@ -1988,6 +2008,7 @@ public function testEmail()
1988
2008
public function testEmailWithMaxLength ()
1989
2009
{
1990
2010
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\EmailType ' , 'foo&bar ' , [
2011
+ 'empty_data ' => null ,
1991
2012
'attr ' => ['maxlength ' => 123 ],
1992
2013
]);
1993
2014
@@ -2019,6 +2040,7 @@ public function testHidden()
2019
2040
public function testDisabled ()
2020
2041
{
2021
2042
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
2043
+ 'empty_data ' => null ,
2022
2044
'disabled ' => true ,
2023
2045
]);
2024
2046
@@ -2165,7 +2187,9 @@ public function testRenderNumberWithHtml5NumberType()
2165
2187
2166
2188
public function testPassword ()
2167
2189
{
2168
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\PasswordType ' , 'foo&bar ' );
2190
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\PasswordType ' , 'foo&bar ' , [
2191
+ 'empty_data ' => null ,
2192
+ ]);
2169
2193
2170
2194
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
2171
2195
'/input
@@ -2179,6 +2203,7 @@ public function testPassword()
2179
2203
public function testPasswordSubmittedWithNotAlwaysEmpty ()
2180
2204
{
2181
2205
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\PasswordType ' , null , [
2206
+ 'empty_data ' => null ,
2182
2207
'always_empty ' => false ,
2183
2208
]);
2184
2209
$ form ->submit ('foo&bar ' );
@@ -2196,6 +2221,7 @@ public function testPasswordSubmittedWithNotAlwaysEmpty()
2196
2221
public function testPasswordWithMaxLength ()
2197
2222
{
2198
2223
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\PasswordType ' , 'foo&bar ' , [
2224
+ 'empty_data ' => null ,
2199
2225
'attr ' => ['maxlength ' => 123 ],
2200
2226
]);
2201
2227
@@ -2355,7 +2381,10 @@ public function testRadioRowWithHelp()
2355
2381
2356
2382
public function testRange ()
2357
2383
{
2358
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\RangeType ' , 42 , ['attr ' => ['min ' => 5 ]]);
2384
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\RangeType ' , 42 , [
2385
+ 'empty_data ' => null ,
2386
+ 'attr ' => ['min ' => 5 ],
2387
+ ]);
2359
2388
2360
2389
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
2361
2390
'/input
@@ -2370,7 +2399,10 @@ public function testRange()
2370
2399
2371
2400
public function testRangeWithMinMaxValues ()
2372
2401
{
2373
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\RangeType ' , 42 , ['attr ' => ['min ' => 5 , 'max ' => 57 ]]);
2402
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\RangeType ' , 42 , [
2403
+ 'empty_data ' => null ,
2404
+ 'attr ' => ['min ' => 5 , 'max ' => 57 ],
2405
+ ]);
2374
2406
2375
2407
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
2376
2408
'/input
@@ -2387,6 +2419,7 @@ public function testRangeWithMinMaxValues()
2387
2419
public function testTextarea ()
2388
2420
{
2389
2421
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextareaType ' , 'foo&bar ' , [
2422
+ 'empty_data ' => null ,
2390
2423
'attr ' => ['pattern ' => 'foo ' ],
2391
2424
]);
2392
2425
@@ -2402,7 +2435,9 @@ public function testTextarea()
2402
2435
2403
2436
public function testText ()
2404
2437
{
2405
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , 'foo&bar ' );
2438
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , 'foo&bar ' , [
2439
+ 'empty_data ' => null ,
2440
+ ]);
2406
2441
2407
2442
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
2408
2443
'/input
@@ -2418,6 +2453,7 @@ public function testText()
2418
2453
public function testTextWithMaxLength ()
2419
2454
{
2420
2455
$ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , 'foo&bar ' , [
2456
+ 'empty_data ' => null ,
2421
2457
'attr ' => ['maxlength ' => 123 ],
2422
2458
]);
2423
2459
@@ -2434,7 +2470,9 @@ public function testTextWithMaxLength()
2434
2470
2435
2471
public function testSearch ()
2436
2472
{
2437
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\SearchType ' , 'foo&bar ' );
2473
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\SearchType ' , 'foo&bar ' , [
2474
+ 'empty_data ' => null ,
2475
+ ]);
2438
2476
2439
2477
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
2440
2478
'/input
@@ -2648,7 +2686,10 @@ public function testTimezoneWithPlaceholder()
2648
2686
public function testUrlWithDefaultProtocol ()
2649
2687
{
2650
2688
$ url = 'http://www.example.com?foo1=bar1&foo2=bar2 ' ;
2651
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\UrlType ' , $ url , ['default_protocol ' => 'http ' ]);
2689
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\UrlType ' , $ url , [
2690
+ 'empty_data ' => null ,
2691
+ 'default_protocol ' => 'http ' ,
2692
+ ]);
2652
2693
2653
2694
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
2654
2695
'/input
@@ -2664,7 +2705,10 @@ public function testUrlWithDefaultProtocol()
2664
2705
public function testUrlWithoutDefaultProtocol ()
2665
2706
{
2666
2707
$ url = 'http://www.example.com?foo1=bar1&foo2=bar2 ' ;
2667
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\UrlType ' , $ url , ['default_protocol ' => null ]);
2708
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\UrlType ' , $ url , [
2709
+ 'empty_data ' => null ,
2710
+ 'default_protocol ' => null ,
2711
+ ]);
2668
2712
2669
2713
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
2670
2714
'/input
@@ -2742,6 +2786,7 @@ public function testReset()
2742
2786
public function testWidgetAttributes ()
2743
2787
{
2744
2788
$ form = $ this ->factory ->createNamed ('text ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , 'value ' , [
2789
+ 'empty_data ' => null ,
2745
2790
'required ' => true ,
2746
2791
'disabled ' => true ,
2747
2792
'attr ' => ['readonly ' => true , 'maxlength ' => 10 , 'pattern ' => '\d+ ' , 'class ' => 'foobar ' , 'data-foo ' => 'bar ' ],
@@ -2756,6 +2801,7 @@ public function testWidgetAttributes()
2756
2801
public function testWidgetAttributeNameRepeatedIfTrue ()
2757
2802
{
2758
2803
$ form = $ this ->factory ->createNamed ('text ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , 'value ' , [
2804
+ 'empty_data ' => null ,
2759
2805
'attr ' => ['foo ' => true ],
2760
2806
]);
2761
2807
@@ -2793,7 +2839,9 @@ public function testButtonAttributeNameRepeatedIfTrue()
2793
2839
public function testTel ()
2794
2840
{
2795
2841
$ tel = '0102030405 ' ;
2796
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TelType ' , $ tel );
2842
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TelType ' , $ tel , [
2843
+ 'empty_data ' => null ,
2844
+ ]);
2797
2845
2798
2846
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
2799
2847
'/input
@@ -2808,7 +2856,9 @@ public function testTel()
2808
2856
public function testColor ()
2809
2857
{
2810
2858
$ color = '#0000ff ' ;
2811
- $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\ColorType ' , $ color );
2859
+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\ColorType ' , $ color , [
2860
+ 'empty_data ' => null ,
2861
+ ]);
2812
2862
2813
2863
$ this ->assertWidgetMatchesXpath ($ form ->createView (), ['attr ' => ['class ' => 'my&class ' ]],
2814
2864
'/input
0 commit comments