8000 [Form] add test for ArrayChoiceList handling null · symfony/symfony@00e3819 · GitHub
[go: up one dir, main page]

Skip to content

Commit 00e3819

Browse files
committed
[Form] add test for ArrayChoiceList handling null
1 parent d3c55cb commit 00e3819

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,13 @@ public function testGetValuesForChoicesEmpty()
209209
$this->assertSame(array(), $this->list->getValuesForChoices(array()));
210210
}
211211

212+
public function testGetChoicesForValuesWithNull()
213+
{
214+
$values = $this->list->getValuesForChoices(array(null));
215+
216+
$this->assertNotEmpty($this->list->getChoicesForValues($values));
217+
}
218+
212219
/**
213220
* @return \Symfony\Component\Form\ChoiceList\ChoiceListInterface
214221
*/

src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class ArrayChoiceListTest extends AbstractChoiceListTest
2222

2323
protected function setUp()
2424
{
25-
parent::setUp();
26-
2725
$this->object = new \stdClass();
26+
27+
parent::setUp();
2828
}
2929

3030
protected function createChoiceList()
@@ -34,12 +34,12 @@ protected function createChoiceList()
3434

3535
protected function getChoices()
3636
{
37-
return array(0, 1, '1', 'a', false, true, $this->object);
37+
return array(0, 1, '1', 'a', false, true, $this->object, null);
3838
}
3939

4040
protected function getValues()
4141
{
42-
return array('0', '1', '2', '3', '4', '5', '6');
42+
return array('0', '1', '2', '3', '4', '5', '6', '7');
4343
}
4444

4545
/**

0 commit comments

Comments
 (0)
0