public function testInitShorthandEntityName()
 {
     $item1 = new SingleIntIdEntity(1, 'Foo');
     $item2 = new SingleIntIdEntity(2, 'Bar');
     $this->em->persist($item1);
     $this->em->persist($item2);
     $choiceList = new EntityChoiceList($this->em, 'SymfonyTestsDoctrine:SingleIntIdEntity');
     $this->assertEquals(array(1, 2), $choiceList->getValuesForChoices(array($item1, $item2)));
     $this->assertEquals(array(1, 2), $choiceList->getIndicesForChoices(array($item1, $item2)));
 }
 public function testMinusReplacedByUnderscoreIfNotLoaded()
 {
     $entity1 = new SingleIdentEntity(-1, 'Foo');
     $entity2 = new SingleIdentEntity(1, 'Bar');
     // Persist for managed state
     $this->em->persist($entity1);
     $this->em->persist($entity2);
     $this->em->flush();
     $choiceList = new EntityChoiceList($this->em, self::SINGLE_IDENT_CLASS, 'name');
     // no getChoices()!
     $this->assertSame(array('_1', 1), $choiceList->getIndicesForChoices(array($entity1, $entity2)));
     $this->assertSame(array('_1', 1), $choiceList->getIndicesForValues(array('-1', '1')));
 }
 public function testPossibleToProvideShorthandEntityName()
 {
     $shorthandName = 'SymfonyTestsDoctrine:SingleIdentEntity';
     $item1 = new SingleIdentEntity(1, 'Foo');
     $item2 = new SingleIdentEntity(2, 'Bar');
     $this->em->persist($item1);
     $this->em->persist($item2);
     $choiceList = new EntityChoiceList($this->em, $shorthandName, 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 testLegacyInitShorthandEntityName()
 {
     $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
     $item1 = new SingleIntIdEntity(1, 'Foo');
     $item2 = new SingleIntIdEntity(2, 'Bar');
     $this->em->persist($item1);
     $this->em->persist($item2);
     $choiceList = new EntityChoiceList($this->em, 'SymfonyTestsDoctrine:SingleIntIdEntity');
     $this->assertEquals(array(1, 2), $choiceList->getIndicesForChoices(array($item1, $item2)));
 }