Skip to content

Commit de08816

Browse files
Merge branch '2.7' into 2.8
* 2.7: [Form] Fix missing choices_as_values=true in tests Conflicts: src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
2 parents 9610602 + f84beb4 commit de08816

File tree

3 files changed

+112
-57
lines changed

3 files changed

+112
-57
lines changed

src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ public function testCheckboxWithValue()
212212
public function testSingleChoice()
213213
{
214214
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
215-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
215+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
216+
'choices_as_values' => true,
216217
'multiple' => false,
217218
'expanded' => false,
218219
));
@@ -234,7 +235,8 @@ public function testSingleChoice()
234235
public function testSingleChoiceWithoutTranslation()
235236
{
236237
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
237-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
238+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
239+
'choices_as_values' => true,
238240
'multiple' => false,
239241
'expanded' => false,
240242
'choice_translation_domain' => false,
@@ -257,7 +259,8 @@ public function testSingleChoiceWithoutTranslation()
257259
public function testSingleChoiceWithPlaceholderWithoutTranslation()
258260
{
259261
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
260-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
262+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
263+
'choices_as_values' => true,
261264
'multiple' => false,
262265
'expanded' => false,
263266
'required' => false,
@@ -283,7 +286,8 @@ public function testSingleChoiceWithPlaceholderWithoutTranslation()
283286
public function testSingleChoiceAttributes()
284287
{
285288
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
286-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
289+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
290+
'choices_as_values' => true,
287291
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
288292
'multiple' => false,
289293
'expanded' => false,
@@ -308,7 +312,8 @@ public function testSingleChoiceAttributes()
308312
public function testSingleChoiceWithPreferred()
309313
{
310314
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
311-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
315+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
316+
'choices_as_values' => true,
312317
'preferred_choices' => array('&b'),
313318
'multiple' => false,
314319
'expanded' => false,
@@ -332,7 +337,8 @@ public function testSingleChoiceWithPreferred()
332337
public function testSingleChoiceWithPreferredAndNoSeparator()
333338
{
334339
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
335-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
340+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
341+
'choices_as_values' => true,
336342
'preferred_choices' => array('&b'),
337343
'multiple' => false,
338344
'expanded' => false,
@@ -355,7 +361,8 @@ public function testSingleChoiceWithPreferredAndNoSeparator()
355361
public function testSingleChoiceWithPreferredAndBlankSeparator()
356362
{
357363
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
358-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
364+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
365+
'choices_as_values' => true,
359366
'preferred_choices' => array('&b'),
360367
'multiple' => false,
361368
'expanded' => false,
@@ -379,7 +386,8 @@ public function testSingleChoiceWithPreferredAndBlankSeparator()
379386
public function testChoiceWithOnlyPreferred()
380387
{
381388
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
382-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
389+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
390+
'choices_as_values' => true,
383391
'preferred_choices' => array('&a', '&b'),
384392
'multiple' => false,
385393
'expanded' => false,
@@ -396,7 +404,8 @@ public function testChoiceWithOnlyPreferred()
396404
public function testSingleChoiceNonRequired()
397405
{
398406
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
399-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
407+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
408+
'choices_as_values' => true,
400409
'required' => false,
401410
'multiple' => false,
402411
'expanded' => false,
@@ -420,7 +429,8 @@ public function testSingleChoiceNonRequired()
420429
public function testSingleChoiceNonRequiredNoneSelected()
421430
{
422431
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
423-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
432+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
433+
'choices_as_values' => true,
424434
'required' => false,
425435
'multiple' => false,
426436
'expanded' => false,
@@ -444,7 +454,8 @@ public function testSingleChoiceNonRequiredNoneSelected()
444454
public function testSingleChoiceNonRequiredWithPlaceholder()
445455
{
446456
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
447-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
457+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
458+
'choices_as_values' => true,
448459
'multiple' => false,
449460
'expanded' => false,
450461
'required' => false,
@@ -469,7 +480,8 @@ public function testSingleChoiceNonRequiredWithPlaceholder()
469480
public function testSingleChoiceRequiredWithPlaceholder()
470481
{
471482
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
472-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
483+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
484+
'choices_as_values' => true,
473485
'required' => true,
474486
'multiple' => false,
475487
'expanded' => false,
@@ -494,7 +506,8 @@ public function testSingleChoiceRequiredWithPlaceholder()
494506
public function testSingleChoiceRequiredWithPlaceholderViaView()
495507
{
496508
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
497-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
509+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
510+
'choices_as_values' => true,
498511
'required' => true,
499512
'multiple' => false,
500513
'expanded' => false,
@@ -519,9 +532,10 @@ public function testSingleChoiceGrouped()
519532
{
520533
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
521534
'choices' => array(
522-
'Group&1' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
523-
'Group&2' => array('&c' => 'Choice&C'),
535+
'Group&1' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
536+
'Group&2' => array('Choice&C' => '&c'),
524537
),
538+
'choices_as_values' => true,
525539
'multiple' => false,
526540
'expanded' => false,
527541
));
@@ -549,7 +563,8 @@ public function testSingleChoiceGrouped()
549563
public function testMultipleChoice()
550564
{
551565
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
552-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
566+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
567+
'choices_as_values' => true,
553568
'required' => true,
554569
'multiple' => true,
555570
'expanded' => false,
@@ -573,7 +588,8 @@ public function testMultipleChoice()
573588
public function testMultipleChoiceAttributes()
574589
{
575590
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
576-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
591+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
592+
'choices_as_values' => true,
577593
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
578594
'required' => true,
579595
'multiple' => true,
@@ -600,7 +616,8 @@ public function testMultipleChoiceAttributes()
600616
public function testMultipleChoiceSkipsPlaceholder()
601617
{
602618
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
603-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
619+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
620+
'choices_as_values' => true,
604621
'multiple' => true,
605622
'expanded' => false,
606623
'placeholder' => 'Test&Me',
@@ -623,7 +640,8 @@ public function testMultipleChoiceSkipsPlaceholder()
623640
public function testMultipleChoiceNonRequired()
624641
{
625642
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
626-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
643+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
644+
'choices_as_values' => true,
627645
'required' => false,
628646
'multiple' => true,
629647
'expanded' => false,
@@ -646,7 +664,8 @@ public function testMultipleChoiceNonRequired()
646664
public function testSingleChoiceExpanded()
647665
{
648666
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
649-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
667+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
668+
'choices_as_values' => true,
650669
'multiple' => false,
651670
'expanded' => true,
652671
));
@@ -681,7 +700,8 @@ public function testSingleChoiceExpanded()
681700
public function testSingleChoiceExpandedWithoutTranslation()
682701
{
683702
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
684-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
703+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
704+
'choices_as_values' => true,
685705
'multiple' => false,
686706
'expanded' => true,
687707
'choice_translation_domain' => false,
@@ -717,7 +737,8 @@ public function testSingleChoiceExpandedWithoutTranslation()
717737
public function testSingleChoiceExpandedAttributes()
718738
{
719739
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
720-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
740+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
741+
'choices_as_values' => true,
721742
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
722743
'multiple' => false,
723744
'expanded' => true,
@@ -755,7 +776,8 @@ public function testSingleChoiceExpandedAttributes()
755776
public function testSingleChoiceExpandedWithPlaceholder()
756777
{
757778
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
758-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
779+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
780+
'choices_as_values' => true,
759781
'multiple' => false,
760782
'expanded' => true,
761783
'placeholder' => 'Test&Me',
@@ -800,7 +822,8 @@ public function testSingleChoiceExpandedWithPlaceholder()
800822
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
801823
{
802824
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
803-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
825+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
826+
'choices_as_values' => true,
804827
'multiple' => false,
805828
'expanded' => true,
806829
'translation_domain' => false,
@@ -846,7 +869,8 @@ public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
846869
public function testSingleChoiceExpandedWithBooleanValue()
847870
{
848871
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
849-
'choices' => array('1' => 'Choice&A', '0' => 'Choice&B'),
872+
'choices' => array('Choice&A' => '1', 'Choice&B' => '0'),
873+
'choices_as_values' => true,
850874
'multiple' => false,
851875
'expanded' => true,
852876
));
@@ -881,7 +905,8 @@ public function testSingleChoiceExpandedWithBooleanValue()
881905
public function testMultipleChoiceExpanded()
882906
{
883907
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
884-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
908+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b', 'Choice&C' => '&c'),
909+
'choices_as_values' => true,
885910
'multiple' => true,
886911
'expanded' => true,
887912
'required' => true,
@@ -926,7 +951,8 @@ public function testMultipleChoiceExpanded()
926951
public function testMultipleChoiceExpandedWithoutTranslation()
927952
{
928953
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
929-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
954+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b', 'Choice&C' => '&c'),
955+
'choices_as_values' => true,
930956
'multiple' => true,
931957
'expanded' => true,
932958
'required' => true,
@@ -972,7 +998,8 @@ public function testMultipleChoiceExpandedWithoutTranslation()
972998
public function testMultipleChoiceExpandedAttributes()
973999
{
9741000
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
975-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
1001+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b', 'Choice&C' => '&c'),
1002+
'choices_as_values' => true,
9761003
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
9771004
'multiple' => true,
9781005
'expanded' => true,

src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ public function testCollectionRowWithCustomBlock()
691691
public function testChoiceRowWithCustomBlock()
692692
{
693693
$form = $this->factory->createNamedBuilder('name_c', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', 'a', array(
694-
'choices' => array('a' => 'ChoiceA', 'b' => 'ChoiceB'),
694+
'choices' => array('ChoiceA' => 'a', 'ChoiceB' => 'b'),
695+
'choices_as_values' => true,
695696
'expanded' => true,
696697
))
697698
->getForm();

0 commit comments

Comments
 (0)