public function testInitArrayUsesToString()
 {
     $this->obj1 = new ObjectChoiceListTest_EntityWithToString('A');
     $this->obj2 = new ObjectChoiceListTest_EntityWithToString('B');
     $this->obj3 = new ObjectChoiceListTest_EntityWithToString('C');
     $this->obj4 = new ObjectChoiceListTest_EntityWithToString('D');
     $this->list = new ObjectChoiceList(array($this->obj1, $this->obj2, $this->obj3, $this->obj4));
     $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
     $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues());
     $this->assertEquals(array(0 => new ChoiceView($this->obj1, '0', 'A'), 1 => new ChoiceView($this->obj2, '1', 'B'), 2 => new ChoiceView($this->obj3, '2', 'C'), 3 => new ChoiceView($this->obj4, '3', 'D')), $this->list->getRemainingViews());
 }
Ejemplo n.º 2
0
 /**
  * Returns the choice views of the choices that are not preferred as nested
  * array with the choice groups as top-level keys.
  *
  * @return array
  *
  * @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface
  */
 public function getRemainingViews()
 {
     if (!$this->loaded) {
         $this->load();
     }
     return parent::getRemainingViews();
 }