Skip to content

Commit

Permalink
minor #18830 [Form] fixed EntityType test with query_builder option a…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
fabpot committed Jun 15, 2016
2 parents e738aed + 74f9c98 commit 3b368a9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Tests/Form/Type/EntityTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,13 @@ public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
$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(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
Expand All @@ -232,7 +237,7 @@ public function testConfigureQueryBuilderWithClosureReturningNull()
},
));

$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()
Expand Down

0 comments on commit 3b368a9

Please sign in to comment.