@@ -240,6 +240,7 @@ public function testSubmitSingleNonExpanded()
240
240
241
241
$ this ->assertEquals ('b ' , $ form ->getData ());
242
242
$ this ->assertEquals ('b ' , $ form ->getViewData ());
243
+ $ this ->assertTrue ($ form ->isSynchronized ());
243
244
}
244
245
245
246
public function testSubmitSingleNonExpandedInvalidChoice ()
@@ -269,6 +270,7 @@ public function testSubmitSingleNonExpandedNull()
269
270
270
271
$ this ->assertNull ($ form ->getData ());
271
272
$ this ->assertSame ('' , $ form ->getViewData ());
273
+ $ this ->assertTrue ($ form ->isSynchronized ());
272
274
}
273
275
274
276
// In edge cases (for example, when choices are loaded dynamically by a
@@ -286,6 +288,7 @@ public function testSubmitSingleNonExpandedNullNoChoices()
286
288
287
289
$ this ->assertNull ($ form ->getData ());
288
290
$ this ->assertSame ('' , $ form ->getViewData ());
291
+ $ this ->assertTrue ($ form ->isSynchronized ());
289
292
}
290
293
291
294
public function testSubmitSingleNonExpandedEmpty ()
@@ -300,6 +303,27 @@ public function testSubmitSingleNonExpandedEmpty()
300
303
301
304
$ this ->assertNull ($ form ->getData ());
302
305
$ this ->assertSame ('' , $ form ->getViewData ());
306
+ $ this ->assertTrue ($ form ->isSynchronized ());
307
+ }
308
+
309
+ public function testSubmitSingleNonExpandedEmptyExplicitEmptyChoice ()
310
+ {
311
+ $ form = $ this ->factory ->create ('choice ' , null , array (
312
+ 'multiple ' => false ,
313
+ 'expanded ' => false ,
314
+ 'choices ' => array (
315
+ 'EMPTY_CHOICE ' => 'Empty ' ,
316
+ ),
317
+ 'choice_value ' => function () {
318
+ return '' ;
319
+ },
320
+ ));
321
+
322
+ $ form ->submit ('' );
323
+
324
+ $ this ->assertSame ('EMPTY_CHOICE ' , $ form ->getData ());
325
+ $ this ->assertSame ('' , $ form ->getViewData ());
326
+ $ this ->assertTrue ($ form ->isSynchronized ());
303
327
}
304
328
305
329
// In edge cases (for example, when choices are loaded dynamically by a
@@ -317,6 +341,7 @@ public function testSubmitSingleNonExpandedEmptyNoChoices()
317
341
318
342
$ this ->assertNull ($ form ->getData ());
319
343
$ this ->assertSame ('' , $ form ->getViewData ());
344
+ $ this ->assertTrue ($ form ->isSynchronized ());
320
345
}
321
346
322
347
public function testSubmitSingleNonExpandedFalse ()
@@ -331,6 +356,7 @@ public function testSubmitSingleNonExpandedFalse()
331
356
332
357
$ this ->assertNull ($ form ->getData ());
333
358
$ this ->assertSame ('' , $ form ->getViewData ());
359
+ $ this ->assertTrue ($ form ->isSynchronized ());
334
360
}
335
361
336
362
// In edge cases (for example, when choices are loaded dynamically by a
@@ -348,6 +374,7 @@ public function testSubmitSingleNonExpandedFalseNoChoices()
348
374
349
375
$ this ->assertNull ($ form ->getData ());
350
376
$ this ->assertSame ('' , $ form ->getViewData ());
377
+ $ this ->assertTrue ($ form ->isSynchronized ());
351
378
}
352
379
353
380
public function testSubmitSingleNonExpandedObjectChoices ()
@@ -366,6 +393,7 @@ public function testSubmitSingleNonExpandedObjectChoices()
366
393
367
394
$ this ->assertEquals ($ this ->objectChoices [1 ], $ form ->getData ());
368
395
$ this ->assertEquals ('2 ' , $ form ->getViewData ());
396
+ $ this ->assertTrue ($ form ->isSynchronized ());
369
397
}
370
398
371
399
/**
@@ -392,6 +420,7 @@ public function testLegacySubmitSingleNonExpandedObjectChoices()
392
420
393
421
$ this ->assertEquals ($ this ->objectChoices [1 ], $ form ->getData ());
394
422
$ this ->assertEquals ('2 ' , $ form ->getViewData ());
423
+ $ this ->assertTrue ($ form ->isSynchronized ());
395
424
}
396
425
397
426
public function testSubmitMultipleNonExpanded ()
@@ -406,6 +435,7 @@ public function testSubmitMultipleNonExpanded()
406
435
407
436
$ this ->assertEquals (array ('a ' , 'b ' ), $ form ->getData ());
408
437
$ this ->assertEquals (array ('a ' , 'b ' ), $ form ->getViewData ());
438
+ $ this ->assertTrue ($ form ->isSynchronized ());
409
439
}
410
440
411
441
public function testSubmitMultipleNonExpandedEmpty ()
@@ -420,6 +450,7 @@ public function testSubmitMultipleNonExpandedEmpty()
420
450
421
451
$ this ->assertSame (array (), $ form ->getData ());
422
452
$ this ->assertSame (array (), $ form ->getViewData ());
453
+ $ this ->assertTrue ($ form ->isSynchronized ());
423
454
}
424
455
425
456
// In edge cases (for example, when choices are loaded dynamically by a
@@ -437,6 +468,7 @@ public function testSubmitMultipleNonExpandedEmptyNoChoices()
437
468
438
469
$ this ->assertSame (array (), $ form ->getData ());
439
470
$ this ->assertSame (array (), $ form ->getViewData ());
471
+ $ this ->assertTrue ($ form ->isSynchronized ());
440
472
}
441
473
442
474
public function testSubmitMultipleNonExpandedInvalidScalarChoice ()
@@ -484,6 +516,7 @@ public function testSubmitMultipleNonExpandedObjectChoices()
484
516
485
517
$ this ->assertEquals (array ($ this ->objectChoices [1 ], $ this ->objectChoices [2 ]), $ form ->getData ());
486
518
$ this ->assertEquals (array ('2 ' , '3 ' ), $ form ->getViewData ());
519
+ $ this ->assertTrue ($ form ->isSynchronized ());
487
520
}
488
521
489
522
/**
@@ -509,6 +542,7 @@ public function testLegacySubmitMultipleNonExpandedObjectChoices()
509
542
510
543
$ this ->assertEquals (array ($ this ->objectChoices [1 ], $ this ->objectChoices [2 ]), $ form ->getData ());
511
544
$ this ->assertEquals (array ('2 ' , '3 ' ), $ form ->getViewData ());
545
+ $ this ->assertTrue ($ form ->isSynchronized ());
512
546
}
513
547
514
548
public function testSubmitSingleExpandedRequired ()
@@ -933,6 +967,8 @@ public function testSubmitSingleExpandedWithEmptyChild()
933
967
$ form ->submit ('' );
934
968
935
969
$ this ->assertNull ($ form ->getData ());
970
+ $ this ->assertTrue ($ form ->isSynchronized ());
971
+
936
972
$ this ->assertTrue ($ form [0 ]->getData ());
937
973
$ this ->assertFalse ($ form [1 ]->getData ());
938
974
$ this ->assertSame ('' , $ form [0 ]->getViewData ());
@@ -953,6 +989,8 @@ public function testSubmitSingleExpandedObjectChoices()
953
989
$ form ->submit ('2 ' );
954
990
955
991
$ this ->assertSame ($ this ->objectChoices [1 ], $ form ->getData ());
992
+ $ this ->assertTrue ($ form ->isSynchronized ());
993
+
956
994
$ this ->assertFalse ($ form [0 ]->getData ());
957
995
$ this ->assertTrue ($ form [1 ]->getData ());
958
996
$ this ->assertFalse ($ form [2 ]->getData ());
@@ -987,6 +1025,8 @@ public function testLegacySubmitSingleExpandedObjectChoices()
987
1025
$ form ->submit ('2 ' );
988
1026
989
1027
$ this ->assertSame ($ this ->objectChoices [1 ], $ form ->getData ());
1028
+ $ this ->assertTrue ($ form ->isSynchronized ());
1029
+
990
1030
$ this ->assertFalse ($ form [0 ]->getData ());
991
1031
$ this ->assertTrue ($ form [1 ]->getData ());
992
1032
$ this ->assertFalse ($ form [2 ]->getData ());
@@ -1010,6 +1050,8 @@ public function testSubmitSingleExpandedNumericChoices()
1010
1050
$ form ->submit ('1 ' );
1011
1051
1012
1052
$ this ->assertSame (1 , $ form ->getData ());
1053
+ $ this ->assertTrue ($ form ->isSynchronized ());
1054
+
1013
1055
$ this ->assertFalse ($ form [0 ]->getData ());
1014
1056
$ this ->assertTrue ($ form [1 ]->getData ());
1015
1057
$ this ->assertFalse ($ form [2 ]->getData ());
@@ -1114,6 +1156,8 @@ public function testSubmitMultipleExpandedEmpty()
1114
1156
$ form ->submit (array ());
1115
1157
1116
1158
$ this ->assertSame (array (), $ form ->getData ());
1159
+ $ this ->assertTrue ($ form ->isSynchronized ());
1160
+
1117
1161
$ this ->assertFalse ($ form [0 ]->getData ());
1118
1162
$ this ->assertFalse ($ form [1 ]->getData ());
1119
1163
$ this ->assertFalse ($ form [2 ]->getData ());
@@ -1140,6 +1184,7 @@ public function testSubmitMultipleExpandedEmptyNoChoices()
1140
1184
$ form ->submit (array ());
1141
1185
1142
1186
$ this ->assertSame (array (), $ form ->getData ());
1187
+ $ this ->assertTrue ($ form ->isSynchronized ());
1143
1188
}
1144
1189
1145
1190
public function testSubmitMultipleExpandedWithEmptyChild ()
@@ -1157,6 +1202,8 @@ public function testSubmitMultipleExpandedWithEmptyChild()
1157
1202
$ form ->submit (array ('' , '2 ' ));
1158
1203
1159
1204
$ this ->assertSame (array ('' , 2 ), $ form ->getData ());
1205
+ $ this ->assertTrue ($ form ->isSynchronized ());
1206
+
1160
1207
$ this ->assertTrue ($ form [0 ]->getData ());
1161
1208
$ this ->assertFalse ($ form [1 ]->getData ());
1162
1209
$ this ->assertTrue ($ form [2 ]->getData ());
@@ -1179,6 +1226,8 @@ public function testSubmitMultipleExpandedObjectChoices()
1179
1226
$ form ->submit (array ('1 ' , '2 ' ));
1180
1227
1181
1228
$ this ->assertSame (array ($ this ->objectChoices [0 ], $ this ->objectChoices [1 ]), $ form ->getData ());
1229
+ $ this ->assertTrue ($ form ->isSynchronized ());
1230
+
1182
1231
$ this ->assertTrue ($ form [0 ]->getData ());
1183
1232
$ this ->assertTrue ($ form [1 ]->getData ());
1184
1233
$ this ->assertFalse ($ form [2 ]->getData ());
@@ -1213,6 +1262,8 @@ public function testLegacySubmitMultipleExpandedObjectChoices()
1213
1262
$ form ->submit (array ('1 ' , '2 ' ));
1214
1263
1215
1264
$ this ->assertSame (array ($ this ->objectChoices [0 ], $ this ->objectChoices [1 ]), $ form ->getData ());
1265
+ $ this ->assertTrue ($ form ->isSynchronized ());
1266
+
1216
1267
$ this ->assertTrue ($ form [0 ]->getData ());
1217
1268
$ this ->assertTrue ($ form [1 ]->getData ());
1218
1269
$ this ->assertFalse ($ form [2 ]->getData ());
@@ -1236,6 +1287,8 @@ public function testSubmitMultipleExpandedNumericChoices()
1236
1287
$ form ->submit (array ('1 ' , '2 ' ));
1237
1288
1238
1289
$ this ->assertSame (array (1 , 2 ), $ form ->getData ());
1290
+ $ this ->assertTrue ($ form ->isSynchronized ());
1291
+
1239
1292
$ this ->assertFalse ($ form [0 ]->getData ());
1240
1293
$ this ->assertTrue ($ form [1 ]->getData ());
1241
1294
$ this ->assertTrue ($ form [2 ]->getData ());
@@ -1264,6 +1317,7 @@ public function testSetDataSingleNonExpandedAcceptsBoolean()
1264
1317
1265
1318
$ this ->assertFalse ($ form ->getData ());
1266
1319
$ this ->assertEquals ('0 ' , $ form ->getViewData ());
1320
+ $ this ->assertTrue ($ form ->isSynchronized ());
1267
1321
}
1268
1322
1269
1323
public function testSetDataMultipleNonExpandedAcceptsBoolean ()
@@ -1278,6 +1332,7 @@ public function testSetDataMultipleNonExpandedAcceptsBoolean()
1278
1332
1279
1333
$ this ->assertEquals (array (false , true ), $ form ->getData ());
1280
1334
$ this ->assertEquals (array ('0 ' , '1 ' ), $ form ->getViewData ());
1335
+ $ this ->assertTrue ($ form ->isSynchronized ());
1281
1336
}
1282
1337
1283
1338
public function testPassRequiredToView ()
@@ -1344,7 +1399,7 @@ public function testChoiceTranslationDomainWithTrueValueToView()
1344
1399
$ this ->assertNull ($ view ->vars ['choice_translation_domain ' ]);
1345
1400
}
1346
1401
1347
- public function testDefaulChoiceTranslationDomainIsSameAsTranslationDomainToView ()
1402
+ public function testDefaultChoiceTranslationDomainIsSameAsTranslationDomainToView ()
1348
1403
{
1349
1404
$ form = $ this ->factory ->create ('choice ' , null , array (
1350
1405
'choices ' => $ this ->choices ,
0 commit comments