public function testGetValuesForChoices() { $item1 = new Item(1, 'Foo'); $item2 = new Item(2, 'Bar'); $choiceList = new ModelChoiceList(self::ITEM_CLASS, 'value', null, null, null, null); $this->assertEquals(array(1, 2), $choiceList->getValuesForChoices(array($item1, $item2))); $this->assertEquals(array(1, 2), $choiceList->getIndicesForChoices(array($item1, $item2))); }
public function testDontAllowInvalidChoiceValues() { $item = new Item(1, 'Foo'); $choiceList = new ModelChoiceList(self::ITEM_CLASS, 'value', array($item)); $this->assertEquals(array(), $choiceList->getValuesForChoices(array(new Item(2, 'Bar')))); $this->assertEquals(array(), $choiceList->getChoicesForValues(array(2))); }