Skip to content

Commit 74f9c98

Browse files
committed
[Form] fixed EntityType test with query_builder option
1 parent 127e871 commit 74f9c98

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Tests/Form/Type/EntityTypeTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,13 @@ public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
222222
$field->submit('2');
223223
}
224224

225-
public function testConfigureQueryBuilderWithClosureReturningNull()
225+
public function testConfigureQueryBuilderWithClosureReturningNullUseDefault()
226226
{
227+
$entity1 = new SingleIntIdEntity(1, 'Foo');
228+
$entity2 = new SingleIntIdEntity(2, 'Bar');
229+
230+
$this->persist(array($entity1, $entity2));
231+
227232
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
228233
'em' => 'default',
229234
'class' => self::SINGLE_IDENT_CLASS,
@@ -232,7 +237,7 @@ public function testConfigureQueryBuilderWithClosureReturningNull()
232237
},
233238
));
234239

235-
$this->assertEquals(array(), $field->createView()->vars['choices']);
240+
$this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']);
236241
}
237242

238243
public function testSetDataSingleNull()

0 commit comments

Comments
 (0)