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

Skip to content

Commit 438569a

Browse files
committed
add choice_translation_domain tests to prevent further regressions
1 parent 4b3015f commit 438569a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
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');

0 commit comments

Comments
 (0)