Skip to content

Commit 3b368a9

Browse files
committed
minor #18830 [Form] fixed EntityType test with query_builder option as null (HeahDude)
This PR was merged into the 2.8 branch. Discussion ---------- [Form] fixed EntityType test with query_builder option as null | Q | A | ------------- | --- | Branch? | 2.8+ | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | symfony/symfony-docs#6599 ref symfony/symfony#13990 (comment). Commits ------- ad8e989 [Form] fixed EntityType test with query_builder option
2 parents e738aed + 74f9c98 commit 3b368a9

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)