minor #17832 [Form] add test for ArrayChoiceList handling null (Tobion)
This PR was merged into the 2.7 branch.
Discussion
----------
[Form] add test for ArrayChoiceList handling null
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
I found this bug but then realised that it was already fixed in #17511.
So this just adds a test.
Commits
-------
00e3819
[Form] add test for ArrayChoiceList handling null
This commit is contained in:
commit
6cc7e2efae
@ -209,6 +209,13 @@ abstract class AbstractChoiceListTest extends \PHPUnit_Framework_TestCase
|
||||
$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
|
||||
*/
|
||||
|
@ -22,9 +22,9 @@ class ArrayChoiceListTest extends AbstractChoiceListTest
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->object = new \stdClass();
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
protected function createChoiceList()
|
||||
@ -34,12 +34,12 @@ class ArrayChoiceListTest extends AbstractChoiceListTest
|
||||
|
||||
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()
|
||||
{
|
||||
return array('0', '1', '2', '3', '4', '5', '6');
|
||||
return array('0', '1', '2', '3', '4', '5', '6', '7');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user