8000 bug #17463 [Form] make tests compatible with Symfony 2.8 and 3.0 (xab… · symfony/symfony@9efa223 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9efa223

Browse files
committed
bug #17463 [Form] make tests compatible with Symfony 2.8 and 3.0 (xabbuh)
This PR was merged into the 2.8 branch. Discussion ---------- [Form] make tests compatible with Symfony 2.8 and 3.0 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 4d2930e make tests compatible with Symfony 2.8 and 3.0
2 parents fd50be9 + 4d2930e commit 9efa223

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
1515
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
1616
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
17-
use Symfony\Component\Form\Tests\Fixtures\ChoiceSubType;
1817

1918
class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
2019
{
@@ -1914,14 +1913,15 @@ public function testInitializeWithDefaultObjectChoice()
19141913
public function testCustomChoiceTypeDoesNotInheritChoiceLabels()
19151914
{
19161915
$builder = $this->factory->createBuilder();
1917-
$builder->add('choice', 'choice', array(
1916+
$builder->add('choice', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
19181917
'choices' => array(
19191918
'1' => '1',
19201919
'2' => '2',
19211920
),
1921+
'choices_as_values' => true,
19221922
)
19231923
);
1924-
$builder->add('subChoice', new ChoiceSubType());
1924+
$builder->add('subChoice', 'Symfony\Component\Form\Tests\Fixtures\ChoiceSubType');
19251925
$form = $builder->getForm();
19261926

19271927
// The default 'choices' normalizer would fill the $choiceLabels, but it has been replaced

src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
/**
1818
* @author Paráda József <joczy.parada@gmail.com>
19-
*/
19+
*/
2020
class ChoiceSubType extends AbstractType
2121
{
2222
/**
2323
* {@inheritdoc}
2424
*/
2525
public function configureOptions(OptionsResolver $resolver)
2626
{
27-
$resolver->setDefaults(array('expanded' => true));
27+
$resolver->setDefaults(array('expanded' => true, 'choices_as_values' => true));
2828
$resolver->setNormalizer('choices', function () {
2929
return array(
3030
'attr1' => 'Attribute 1',
@@ -33,19 +33,11 @@ public function configureOptions(OptionsResolver $resolver)
3333
});
3434
}
3535

36-
/**
37-
* {@inheritdoc}
38-
*/
39-
public function getName()
40-
{
41-
return 'sub_choice';
42-
}
43-
4436
/**
4537
* {@inheritdoc}
4638
*/
4739
public function getParent()
4840
{
49-
return 'choice';
41+
return 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
5042
}
5143
}

0 commit comments

Comments
 (0)
0