Skip to content

Commit ffac441

Browse files
committed
[Form] add test for ArrayChoiceList handling null
1 parent fd33367 commit ffac441

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
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: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818
*/
1919
class ArrayChoiceListTest extends AbstractChoiceListTest
2020
{
21-
private $object;
22-
2321
protected function setUp()
2422
{
2523
parent::setUp();
26-
27-
$this->object = new \stdClass();
2824
}
2925

3026
protected function createChoiceList()
@@ -34,12 +30,12 @@ protected function createChoiceList()
3430

3531
protected function getChoices()
3632
{
37-
return array(0, 1, '1', 'a', false, true, $this->object);
33+
return array(0, 1, '1', 'a', false, true, new \stdClass(), null);
3834
}
3935

4036
protected function getValues()
4137
{
42-
return array('0', '1', '2', '3', '4', '5', '6');
38+
return array('0', '1', '2', '3', '4', '5', '6', '7');
4339
}
4440

4541
/**

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy