Added test case for 4c6a2d15095c13b2a35751b2b2712b183be489c4
This commit is contained in:
parent
73d56f7a1a
commit
18dc9a7f5f
@ -1216,6 +1216,47 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/symfony/symfony/issues/10409
|
||||||
|
public function testReuseNonUtf8ChoiceLists()
|
||||||
|
{
|
||||||
|
$form1 = $this->factory->createNamed('name', 'choice', null, array(
|
||||||
|
'choices' => array(
|
||||||
|
'meter' => 'm',
|
||||||
|
'millimeter' => 'mm',
|
||||||
|
'micrometer' => chr(181).'meter',
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$form2 = $this->factory->createNamed('name', 'choice', null, array(
|
||||||
|
'choices' => array(
|
||||||
|
'meter' => 'm',
|
||||||
|
'millimeter' => 'mm',
|
||||||
|
'micrometer' => chr(181).'meter',
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$form3 = $this->factory->createNamed('name', 'choice', null, array(
|
||||||
|
'choices' => array(
|
||||||
|
'meter' => 'm',
|
||||||
|
'millimeter' => 'mm',
|
||||||
|
'micrometer' => null,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
// $form1 and $form2 use the same ChoiceList
|
||||||
|
$this->assertSame(
|
||||||
|
$form1->getConfig()->getOption('choice_list'),
|
||||||
|
$form2->getConfig()->getOption('choice_list')
|
||||||
|
);
|
||||||
|
|
||||||
|
// $form3 doesn't, but used to use the same when using json_encode()
|
||||||
|
// instead of serialize for the hashing algorithm
|
||||||
|
$this->assertNotSame(
|
||||||
|
$form1->getConfig()->getOption('choice_list'),
|
||||||
|
$form3->getConfig()->getOption('choice_list')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testInitializeWithDefaultObjectChoice()
|
public function testInitializeWithDefaultObjectChoice()
|
||||||
{
|
{
|
||||||
$obj1 = (object) array('value' => 'a', 'label' => 'A');
|
$obj1 = (object) array('value' => 'a', 'label' => 'A');
|
||||||
|
Reference in New Issue
Block a user