@@ -56,6 +56,39 @@ public function testChoiceTranslationLocaleOption()
56
56
$ this ->assertContains (new ChoiceView ('my ' , 'my ' , 'бірманська ' ), $ choices , '' , false , false );
57
57
}
58
58
59
+ /**
60
+ * @requires extension intl
61
+ */
62
+ public function testChoiceSelfTranslationOption ()
63
+ {
64
+ $ choices = $ this ->factory
65
+ ->create (static ::TESTED_TYPE , null , [
66
+ 'choice_self_translation ' => true ,
67
+ ])
68
+ ->createView ()->vars ['choices ' ];
69
+
70
+ // Don't check objects for identity
71
+ $ this ->assertContains (new ChoiceView ('cs ' , 'cs ' , 'čeština ' ), $ choices , '' , false , false );
72
+ $ this ->assertContains (new ChoiceView ('es ' , 'es ' , 'español ' ), $ choices , '' , false , false );
73
+ $ this ->assertContains (new ChoiceView ('fr ' , 'fr ' , 'français ' ), $ choices , '' , false , false );
74
+ $ this ->assertContains (new ChoiceView ('ta ' , 'ta ' , 'தமிழ் ' ), $ choices , '' , false , false );
75
+ $ this ->assertContains (new ChoiceView ('uk ' , 'uk ' , 'українська ' ), $ choices , '' , false , false );
76
+ $ this ->assertContains (new ChoiceView ('yi ' , 'yi ' , 'ייִדיש ' ), $ choices , '' , false , false );
77
+ $ this ->assertContains (new ChoiceView ('zh ' , 'zh ' , '中文 ' ), $ choices , '' , false , false );
78
+ $ this ->assertContains (new ChoiceView ('zh_Hant ' , 'zh_Hant ' , '繁體中文 ' ), $ choices , '' , false , false );
79
+ }
80
+
81
+ /**
82
+ * @expectedException \Symfony\Component\Form\Exception\LogicException
83
+ */
84
+ public function testSelfTranslationNotAllowedWithChoiceTranslation ()
85
+ {
86
+ $ this ->factory ->create (static ::TESTED_TYPE , null , [
87
+ 'choice_translation_locale ' => 'es ' ,
88
+ 'choice_self_translation ' => true ,
89
+ ]);
90
+ }
91
+
59
92
public function testMultipleLanguagesIsNotIncluded ()
60
93
{
61
94
$ choices = $ this ->factory ->create (static ::TESTED_TYPE , 'language ' )
0 commit comments