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