Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class ArrayChoiceListTest extends AbstractChoiceListTest

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

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

parent::setUp();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was broken because it was initialized after getChoices is called. so $this->object was actually null.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should maybe just put it before the call to parent::setUp() instead of removing it and keep using $this->object in getChoices()

}

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