Skip to content

Commit 64515b8

Browse files
committed
Merge branch '3.0'
* 3.0: make tests compatible with Symfony 2.8 and 3.0
2 parents a729462 + 78c8543 commit 64515b8

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
1515
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
16-
use Symfony\Component\Form\Tests\Fixtures\ChoiceSubType;
1716

1817
class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
1918
{
@@ -1491,14 +1490,15 @@ public function testInitializeWithDefaultObjectChoice()
14911490
public function testCustomChoiceTypeDoesNotInheritChoiceLabels()
14921491
{
14931492
$builder = $this->factory->createBuilder();
1494-
$builder->add('choice', 'choice', array(
1493+
$builder->add('choice', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
14951494
'choices' => array(
14961495
'1' => '1',
14971496
'2' => '2',
14981497
),
1498+
'choices_as_values' => true,
14991499
)
15001500
);
1501-
$builder->add('subChoice', new ChoiceSubType());
1501+
$builder->add('subChoice', 'Symfony\Component\Form\Tests\Fixtures\ChoiceSubType');
15021502
$form = $builder->getForm();
15031503

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

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

+3-11
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)