[Form] fixed EntityType test with query_builder option

This commit is contained in:
Jules Pietri 2016-05-21 20:24:27 +02:00
parent 7d6e9b20ab
commit ad8e98955f

View File

@ -222,8 +222,13 @@ class EntityTypeTest extends TypeTestCase
$field->submit('2'); $field->submit('2');
} }
public function testConfigureQueryBuilderWithClosureReturningNull() public function testConfigureQueryBuilderWithClosureReturningNullUseDefault()
{ {
$entity1 = new SingleIntIdEntity(1, 'Foo');
$entity2 = new SingleIntIdEntity(2, 'Bar');
$this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array( $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
@ -232,7 +237,7 @@ class EntityTypeTest extends TypeTestCase
}, },
)); ));
$this->assertEquals(array(), $field->createView()->vars['choices']); $this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']);
} }
public function testSetDataSingleNull() public function testSetDataSingleNull()