File tree 2 files changed +18
-2
lines changed
src/Symfony/Component/Form
Tests/Extension/Core/Type
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -179,9 +179,9 @@ public function getDefaultOptions()
179
179
if ($ form ->hasChildren ()) {
180
180
return array ();
181
181
}
182
- };
183
182
184
- return '' ;
183
+ return '' ;
184
+ };
185
185
};
186
186
187
187
return array (
Original file line number Diff line number Diff line change @@ -344,6 +344,22 @@ public function testBindWithEmptyDataStoresArrayIfNoClassAvailable()
344
344
$ this ->assertSame (array ('firstName ' => 'Bernhard ' ), $ form ->getData ());
345
345
}
346
346
347
+ public function testBindWithEmptyDataPassesEmptyStringToTransformerIfNoChildren ()
348
+ {
349
+ $ form = $ this ->factory ->createBuilder ('form ' )
350
+ ->appendClientTransformer (new FixedDataTransformer (array (
351
+ // required for the initial, internal setData(null)
352
+ null => 'null ' ,
353
+ // required to test that bind(null) is converted to ''
354
+ 'empty ' => '' ,
355
+ )))
356
+ ->getForm ();
357
+
358
+ $ form ->bind (null );
359
+
360
+ $ this ->assertSame ('empty ' , $ form ->getData ());
361
+ }
362
+
347
363
public function testBindWithEmptyDataUsesEmptyDataOption ()
348
364
{
349
365
$ author = new Author ();
You can’t perform that action at this time.
0 commit comments