This repository was archived by the owner on Jan 30, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -195,11 +195,6 @@ public function populateValues($data)
195
195
));
196
196
}
197
197
198
- // Can't do anything with empty data
199
- if (empty ($ data )) {
200
- return ;
201
- }
202
-
203
198
if (!$ this ->allowRemove && count ($ data ) < $ this ->count ) {
204
199
throw new Exception \DomainException (sprintf (
205
200
'There are fewer elements than specified in the collection (%s). Either set the allow_remove option '
Original file line number Diff line number Diff line change @@ -938,11 +938,15 @@ public function testCanRemoveAllElementsIfAllowRemoveIsTrue()
938
938
$ collection ->setAllowRemove (true );
939
939
$ collection ->setCount (0 );
940
940
941
-
942
941
// By default, $collection contains 2 elements
943
942
$ data = [];
943
+ $ data [] = 'blue ' ;
944
+ $ data [] = 'green ' ;
944
945
945
946
$ collection ->populateValues ($ data );
947
+ $ this ->assertEquals (2 , count ($ collection ->getElements ()));
948
+
949
+ $ collection ->populateValues ([]);
946
950
$ this ->assertEquals (0 , count ($ collection ->getElements ()));
947
951
}
948
952
@@ -1233,14 +1237,14 @@ public function testCollectionShouldSilentlyIgnorePopulatingFieldsetWithDisallow
1233
1237
public function testCanHydrateObject ()
1234
1238
{
1235
1239
$ form = $ this ->form ;
1240
+ $ object = new \ArrayObject ();
1241
+ $ form ->bind ($ object );
1236
1242
$ data = [
1237
1243
'colors ' => [
1238
1244
'#ffffff ' ,
1239
1245
],
1240
1246
];
1241
1247
$ form ->setData ($ data );
1242
- $ object = new \ArrayObject ();
1243
- $ form ->bind ($ object );
1244
1248
$ this ->assertTrue ($ form ->isValid ());
1245
1249
$ this ->assertInternalType ('array ' , $ object ['colors ' ]);
1246
1250
$ this ->assertCount (1 , $ object ['colors ' ]);
You can’t perform that action at this time.
0 commit comments