Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71e8028

Browse files
committed
minor #38163 [DoctrineBridge] add choice_translation_domain tests to prevent further regressions (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [DoctrineBridge] add choice_translation_domain tests to prevent further regressions | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix ##37521 (comment) | License | MIT | Doc PR | Commits ------- 7775b37 add choice_translation_domain tests to prevent further regressions
2 parents 3825542 + 7775b37 commit 71e8028

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,39 @@ public function testInvalidClassOption()
138138
]);
139139
}
140140

141+
/**
142+
* @dataProvider choiceTranslationDomainProvider
143+
*/
144+
public function testChoiceTranslationDomainIsDisabledByDefault($expanded)
145+
{
146+
$entity1 = new SingleIntIdEntity(1, 'Foo');
147+
148+
$this->persist([$entity1]);
149+
150+
$field = $this->factory->createNamed('name', static::TESTED_TYPE, null, [
151+
'choices' => [
152+
$entity1,
153+
],
154+
'class' => SingleIntIdEntity::class,
155+
'em' => 'default',
156+
'expanded' => $expanded,
157+
]);
158+
159+
if ($expanded) {
160+
$this->assertFalse($field->get('1')->getConfig()->getOption('translation_domain'));
161+
} else {
162+
$this->assertFalse($field->getConfig()->getOption('choice_translation_domain'));
163+
}
164+
}
165+
166+
public function choiceTranslationDomainProvider()
167+
{
168+
return [
169+
[false],
170+
[true],
171+
];
172+
}
173+
141174
public function testSetDataToUninitializedEntityWithNonRequired()
142175
{
143176
$entity1 = new SingleIntIdEntity(1, 'Foo');

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"doctrine/annotations": "~1.7",
2626
"symfony/stopwatch": "~2.8|~3.0|~4.0",
2727
"symfony/dependency-injection": "~3.4|~4.0",
28-
"symfony/form": "^3.3.10|~4.0",
28+
"symfony/form": "^3.4.43|~4.4.11",
2929
"symfony/http-kernel": "~2.8|~3.0|~4.0",
3030
"symfony/property-access": "~2.8|~3.0|~4.0",
3131
"symfony/property-info": "~2.8|3.0|~4.0",

0 commit comments

Comments
 (0)