$field =
$this->factory->
createNamed('name',
static::TESTED_TYPE, null,
[ 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'choice_label' => 'name',
]);
$this->em->
clear();
$field->
submit(1
);
$unitOfWorkIdentityMap =
$this->em->
getUnitOfWork()->
getIdentityMap();
$managedEntitiesNames =
array_map('strval',
$unitOfWorkIdentityMap['Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity'
]);
$this->
assertContains((string) $entity1,
$managedEntitiesNames);
$this->
assertNotContains((string) $entity2,
$managedEntitiesNames);
} public function testGroupByChoices() { $item1 =
new GroupableEntity(1, 'Foo', 'Group1'
);
$item2 =
new GroupableEntity(2, 'Bar', 'Group1'
);
$item3 =
new GroupableEntity(3, 'Baz', 'Group2'
);