Skip to content

Commit

Permalink
minor #17832 [Form] add test for ArrayChoiceList handling null (Tobion)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fabpot committed Feb 18, 2016
2 parents d3c55cb + 00e3819 commit 6cc7e2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Expand Up @@ -209,6 +209,13 @@ public function testGetValuesForChoicesEmpty()
$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
*/
Expand Down
Expand Up @@ -22,9 +22,9 @@ class ArrayChoiceListTest extends AbstractChoiceListTest

protected function setUp()
{
parent::setUp();

$this->object = new \stdClass();

parent::setUp();
}

protected function createChoiceList()
Expand All @@ -34,12 +34,12 @@ protected function createChoiceList()

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');
}

/**
Expand Down

0 comments on commit 6cc7e2e

Please sign in to comment.