@@ -119,6 +119,102 @@ public function testDefaultTranslationDomain()
119119 $ this ->assertNull ($ view ['child ' ]->vars ['translation_domain ' ]);
120120 }
121121
122+ public function testPassLabelTranslationParametersToView ()
123+ {
124+ $ view = $ this ->factory ->create ($ this ->getTestedType (), null , [
125+ 'label_translation_parameters ' => ['%param% ' => 'value ' ],
126+ ])
127+ ->createView ();
128+
129+ $ this ->assertSame (['%param% ' => 'value ' ], $ view ->vars ['label_translation_parameters ' ]);
130+ }
131+
132+ public function testPassAttrTranslationParametersToView ()
133+ {
134+ $ view = $ this ->factory ->create ($ this ->getTestedType (), null , [
135+ 'attr_translation_parameters ' => ['%param% ' => 'value ' ],
136+ ])
137+ ->createView ();
138+
139+ $ this ->assertSame (['%param% ' => 'value ' ], $ view ->vars ['attr_translation_parameters ' ]);
140+ }
141+
142+ public function testInheritLabelTranslationParametersFromParent ()
143+ {
144+ $ view = $ this ->factory
145+ ->createNamedBuilder ('parent ' , FormTypeTest::TESTED_TYPE , null , [
146+ 'label_translation_parameters ' => ['%param% ' => 'value ' ],
147+ ])
148+ ->add ('child ' , $ this ->getTestedType ())
149+ ->getForm ()
150+ ->createView ();
151+
152+ $ this ->assertEquals (['%param% ' => 'value ' ], $ view ['child ' ]->vars ['label_translation_parameters ' ]);
153+ }
154+
155+ public function testInheritAttrTranslationParametersFromParent ()
156+ {
157+ $ view = $ this ->factory
158+ ->createNamedBuilder ('parent ' , FormTypeTest::TESTED_TYPE , null , [
159+ 'attr_translation_parameters ' => ['%param% ' => 'value ' ],
160+ ])
161+ ->add ('child ' , $ this ->getTestedType ())
162+ ->getForm ()
163+ ->createView ();
164+
165+ $ this ->assertEquals (['%param% ' => 'value ' ], $ view ['child ' ]->vars ['attr_translation_parameters ' ]);
166+ }
167+
168+ public function testPreferOwnLabelTranslationParameters ()
169+ {
170+ $ view = $ this ->factory
171+ ->createNamedBuilder ('parent ' , FormTypeTest::TESTED_TYPE , null , [
172+ 'label_translation_parameters ' => ['%parent_param% ' => 'parent_value ' , '%override_param% ' => 'parent_override_value ' ],
173+ ])
174+ ->add ('child ' , $ this ->getTestedType (), [
175+ 'label_translation_parameters ' => ['%override_param% ' => 'child_value ' ],
176+ ])
177+ ->getForm ()
178+ ->createView ();
179+
180+ $ this ->assertEquals (['%parent_param% ' => 'parent_value ' , '%override_param% ' => 'child_value ' ], $ view ['child ' ]->vars ['label_translation_parameters ' ]);
181+ }
182+
183+ public function testPreferOwnAttrTranslationParameters ()
184+ {
185+ $ view = $ this ->factory
186+ ->createNamedBuilder ('parent ' , FormTypeTest::TESTED_TYPE , null , [
187+ 'attr_translation_parameters ' => ['%parent_param% ' => 'parent_value ' , '%override_param% ' => 'parent_override_value ' ],
188+ ])
189+ ->add ('child ' , $ this ->getTestedType (), [
190+ 'attr_translation_parameters ' => ['%override_param% ' => 'child_value ' ],
191+ ])
192+ ->getForm ()
193+ ->createView ();
194+
195+ $ this ->assertEquals (['%parent_param% ' => 'parent_value ' , '%override_param% ' => 'child_value ' ], $ view ['child ' ]->vars ['attr_translation_parameters ' ]);
196+ }
197+
198+ public function testDefaultLabelTranslationParameters ()
199+ {
200+ $ view = $ this ->factory ->createNamedBuilder ('parent ' , FormTypeTest::TESTED_TYPE )
201+ ->add ('child ' , $ this ->getTestedType ())
202+ ->getForm ()
203+ ->createView ();
204+
205+ $ this ->assertEquals ([], $ view ['child ' ]->vars ['label_translation_parameters ' ]);
206+ }
207+
208+ public function testDefaultAttrTranslationParameters ()
209+ {
210+ $ view = $ this ->factory ->createNamedBuilder ('parent ' , FormTypeTest::TESTED_TYPE )
211+ ->add ('child ' , $ this ->getTestedType ())
212+ ->getForm ()
213+ ->createView ();
214+
215+ $ this ->assertEquals ([], $ view ['child ' ]->vars ['attr_translation_parameters ' ]);
216+ }
217+
122218 public function testPassLabelToView ()
123219 {
124220 $ view = $ this ->factory ->createNamed ('__test___field ' , $ this ->getTestedType (), null , ['label ' => 'My label ' ])
0 commit comments