Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aa4bc47

Browse files
Merge branch '2.8'
* 2.8: [Form] Fix missing choices_as_values=true in tests [HttpFoundation] Deprecate $deep parameter on ParameterBag Conflicts: src/Symfony/Component/HttpFoundation/ParameterBag.php src/Symfony/Component/HttpFoundation/Request.php
2 parents 9b9fa3d + de08816 commit aa4bc47

File tree

5 files changed

+138
-68
lines changed

5 files changed

+138
-68
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,
@@ -306,7 +310,8 @@ public function testSingleChoiceAttributes()
306310
public function testSingleChoiceWithPreferred()
307311
{
308312
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
309-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
313+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
314+
'choices_as_values' => true,
310315
'preferred_choices' => array('&b'),
311316
'multiple' => false,
312317
'expanded' => false,
@@ -330,7 +335,8 @@ public function testSingleChoiceWithPreferred()
330335
public function testSingleChoiceWithPreferredAndNoSeparator()
331336
{
332337
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
333-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
338+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
339+
'choices_as_values' => true,
334340
'preferred_choices' => array('&b'),
335341
'multiple' => false,
336342
'expanded' => false,
@@ -353,7 +359,8 @@ public function testSingleChoiceWithPreferredAndNoSeparator()
353359
public function testSingleChoiceWithPreferredAndBlankSeparator()
354360
{
355361
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
356-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
362+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
363+
'choices_as_values' => true,
357364
'preferred_choices' => array('&b'),
358365
'multiple' => false,
359366
'expanded' => false,
@@ -377,7 +384,8 @@ public function testSingleChoiceWithPreferredAndBlankSeparator()
377384
public function testChoiceWithOnlyPreferred()
378385
{
379386
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
380-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
387+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
388+
'choices_as_values' => true,
381389
'preferred_choices' => array('&a', '&b'),
382390
'multiple' => false,
383391
'expanded' => false,
@@ -394,7 +402,8 @@ public function testChoiceWithOnlyPreferred()
394402
public function testSingleChoiceNonRequired()
395403
{
396404
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
397-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
405+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
406+
'choices_as_values' => true,
398407
'required' => false,
399408
'multiple' => false,
400409
'expanded' => false,
@@ -418,7 +427,8 @@ public function testSingleChoiceNonRequired()
418427
public function testSingleChoiceNonRequiredNoneSelected()
419428
{
420429
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
421-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
430+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
431+
'choices_as_values' => true,
422432
'required' => false,
423433
'multiple' => false,
424434
'expanded' => false,
@@ -442,7 +452,8 @@ public function testSingleChoiceNonRequiredNoneSelected()
442452
public function testSingleChoiceNonRequiredWithPlaceholder()
443453
{
444454
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
445-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
455+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
456+
'choices_as_values' => true,
446457
'multiple' => false,
447458
'expanded' => false,
448459
'required' => false,
@@ -467,7 +478,8 @@ public function testSingleChoiceNonRequiredWithPlaceholder()
467478
public function testSingleChoiceRequiredWithPlaceholder()
468479
{
469480
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
470-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
481+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
482+
'choices_as_values' => true,
471483
'required' => true,
472484
'multiple' => false,
473485
'expanded' => false,
@@ -492,7 +504,8 @@ public function testSingleChoiceRequiredWithPlaceholder()
492504
public function testSingleChoiceRequiredWithPlaceholderViaView()
493505
{
494506
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
495-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
507+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
508+
'choices_as_values' => true,
496509
'required' => true,
497510
'multiple' => false,
498511
'expanded' => false,
@@ -517,9 +530,10 @@ public function testSingleChoiceGrouped()
517530
{
518531
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
519532
'choices' => array(
520-
'Group&1' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
521-
'Group&2' => array('&c' => 'Choice&C'),
533+
'Group&1' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
534+
'Group&2' => array('Choice&C' => '&c'),
522535
),
536+
'choices_as_values' => true,
523537
'multiple' => false,
524538
'expanded' => false,
525539
));
@@ -547,7 +561,8 @@ public function testSingleChoiceGrouped()
547561
public function testMultipleChoice()
548562
{
549563
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
550-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
564+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
565+
'choices_as_values' => true,
551566
'required' => true,
552567
'multiple' => true,
553568
'expanded' => false,
@@ -571,7 +586,8 @@ public function testMultipleChoice()
571586
public function testMultipleChoiceAttributes()
572587
{
573588
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
574-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
589+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
590+
'choices_as_values' => true,
575591
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
576592
'required' => true,
577593
'multiple' => true,
@@ -596,7 +612,8 @@ public function testMultipleChoiceAttributes()
596612
public function testMultipleChoiceSkipsPlaceholder()
597613
{
598614
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
599-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
615+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
616+
'choices_as_values' => true,
600617
'multiple' => true,
601618
'expanded' => false,
602619
'placeholder' => 'Test&Me',
@@ -619,7 +636,8 @@ public function testMultipleChoiceSkipsPlaceholder()
619636
public function testMultipleChoiceNonRequired()
620637
{
621638
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
622-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
639+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
640+
'choices_as_values' => true,
623641
'required' => false,
624642
'multiple' => true,
625643
'expanded' => false,
@@ -642,7 +660,8 @@ public function testMultipleChoiceNonRequired()
642660
public function testSingleChoiceExpanded()
643661
{
644662
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
645-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
663+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
664+
'choices_as_values' => true,
646665
'multiple' => false,
647666
'expanded' => true,
648667
));
@@ -677,7 +696,8 @@ public function testSingleChoiceExpanded()
677696
public function testSingleChoiceExpandedWithoutTranslation()
678697
{
679698
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
680-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
699+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
700+
'choices_as_values' => true,
681701
'multiple' => false,
682702
'expanded' => true,
683703
'choice_translation_domain' => false,
@@ -713,7 +733,8 @@ public function testSingleChoiceExpandedWithoutTranslation()
713733
public function testSingleChoiceExpandedAttributes()
714734
{
715735
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
716-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
736+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
737+
'choices_as_values' => true,
717738
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
718739
'multiple' => false,
719740
'expanded' => true,
@@ -749,7 +770,8 @@ public function testSingleChoiceExpandedAttributes()
749770
public function testSingleChoiceExpandedWithPlaceholder()
750771
{
751772
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
752-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
773+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
774+
'choices_as_values' => true,
753775
'multiple' => false,
754776
'expanded' => true,
755777
'placeholder' => 'Test&Me',
@@ -794,7 +816,8 @@ public function testSingleChoiceExpandedWithPlaceholder()
794816
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
795817
{
796818
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
797-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
819+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b'),
820+
'choices_as_values' => true,
798821
'multiple' => false,
799822
'expanded' => true,
800823
'translation_domain' => false,
@@ -840,7 +863,8 @@ public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
840863
public function testSingleChoiceExpandedWithBooleanValue()
841864
{
842865
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
843-
'choices' => array('1' => 'Choice&A', '0' => 'Choice&B'),
866+
'choices' => array('Choice&A' => '1', 'Choice&B' => '0'),
867+
'choices_as_values' => true,
844868
'multiple' => false,
845869
'expanded' => true,
846870
));
@@ -875,7 +899,8 @@ public function testSingleChoiceExpandedWithBooleanValue()
875899
public function testMultipleChoiceExpanded()
876900
{
877901
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
878-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
902+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b', 'Choice&C' => '&c'),
903+
'choices_as_values' => true,
879904
'multiple' => true,
880905
'expanded' => true,
881906
'required' => true,
@@ -920,7 +945,8 @@ public function testMultipleChoiceExpanded()
920945
public function testMultipleChoiceExpandedWithoutTranslation()
921946
{
922947
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
923-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
948+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b', 'Choice&C' => '&c'),
949+
'choices_as_values' => true,
924950
'multiple' => true,
925951
'expanded' => true,
926952
'required' => true,
@@ -966,7 +992,8 @@ public function testMultipleChoiceExpandedWithoutTranslation()
966992
public function testMultipleChoiceExpandedAttributes()
967993
{
968994
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
969-
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
995+
'choices' => array('Choice&A' => '&a', 'Choice&B' => '&b', 'Choice&C' => '&c'),
996+
'choices_as_values' => true,
970997
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
971998
'multiple' => true,
972999
'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)