[Form] add test for ArrayChoiceList handling null

This commit is contained in:
Tobias Schultze 2016-02-17 20:31:02 +01:00
parent d3c55cb3f1
commit 00e38198b7
2 changed files with 11 additions and 4 deletions

View File

@ -209,6 +209,13 @@ abstract class AbstractChoiceListTest extends \PHPUnit_Framework_TestCase
$this->assertSame(array(), $this->list->getValuesForChoices(array())); $this->assertSame(array(), $this->list->getValuesForChoices(array()));
} }
public function testGetChoicesForValuesWithNull()
{
$values = $this->list->getValuesForChoices(array(null));
$this->assertNotEmpty($this->list->getChoicesForValues($values));
}
/** /**
* @return \Symfony\Component\Form\ChoiceList\ChoiceListInterface * @return \Symfony\Component\Form\ChoiceList\ChoiceListInterface
*/ */

View File

@ -22,9 +22,9 @@ class ArrayChoiceListTest extends AbstractChoiceListTest
protected function setUp() protected function setUp()
{ {
parent::setUp();
$this->object = new \stdClass(); $this->object = new \stdClass();
parent::setUp();
} }
protected function createChoiceList() protected function createChoiceList()
@ -34,12 +34,12 @@ class ArrayChoiceListTest extends AbstractChoiceListTest
protected function getChoices() protected function getChoices()
{ {
return array(0, 1, '1', 'a', false, true, $this->object); return array(0, 1, '1', 'a', false, true, $this->object, null);
} }
protected function getValues() protected function getValues()
{ {
return array('0', '1', '2', '3', '4', '5', '6'); return array('0', '1', '2', '3', '4', '5', '6', '7');
} }
/** /**