@@ -519,4 +519,57 @@ public function testTimeTypeSingleTextErrorsBubbleUp()
519519 $ this ->assertSame (array (), iterator_to_array ($ form ['time ' ]->getErrors ()));
520520 $ this ->assertSame (array ($ error ), iterator_to_array ($ form ->getErrors ()));
521521 }
522+
523+ public function testPassDefaultChoiceTranslationDomain ()
524+ {
525+ $ form = $ this ->factory ->create ('Symfony\Component\Form\Extension\Core\Type\DateTimeType ' , null , array (
526+ 'with_seconds ' => true ,
527+ ));
528+
529+ $ view = $ form ->createView ();
530+
531+ $ this ->assertFalse ($ view ['date ' ]['year ' ]->vars ['choice_translation_domain ' ]);
532+ $ this ->assertFalse ($ view ['date ' ]['month ' ]->vars ['choice_translation_domain ' ]);
533+ $ this ->assertFalse ($ view ['date ' ]['day ' ]->vars ['choice_translation_domain ' ]);
534+ $ this ->assertFalse ($ view ['time ' ]['hour ' ]->vars ['choice_translation_domain ' ]);
535+ $ this ->assertFalse ($ view ['time ' ]['minute ' ]->vars ['choice_translation_domain ' ]);
536+ $ this ->assertFalse ($ view ['time ' ]['second ' ]->vars ['choice_translation_domain ' ]);
537+ }
538+
539+ public function testPassChoiceTranslationDomainAsString ()
540+ {
541+ $ form = $ this ->factory ->create ('Symfony\Component\Form\Extension\Core\Type\DateTimeType ' , null , array (
542+ 'choice_translation_domain ' => 'messages ' ,
543+ 'with_seconds ' => true ,
544+ ));
545+
546+ $ view = $ form ->createView ();
547+ $ this ->assertSame ('messages ' , $ view ['date ' ]['year ' ]->vars ['choice_translation_domain ' ]);
548+ $ this ->assertSame ('messages ' , $ view ['date ' ]['month ' ]->vars ['choice_translation_domain ' ]);
549+ $ this ->assertSame ('messages ' , $ view ['date ' ]['day ' ]->vars ['choice_translation_domain ' ]);
550+ $ this ->assertSame ('messages ' , $ view ['time ' ]['hour ' ]->vars ['choice_translation_domain ' ]);
551+ $ this ->assertSame ('messages ' , $ view ['time ' ]['minute ' ]->vars ['choice_translation_domain ' ]);
552+ $ this ->assertSame ('messages ' , $ view ['time ' ]['second ' ]->vars ['choice_translation_domain ' ]);
553+ }
554+
555+ public function testPassChoiceTranslationDomainAsArray ()
556+ {
557+ $ form = $ this ->factory ->create ('Symfony\Component\Form\Extension\Core\Type\DateTimeType ' , null , array (
558+ 'choice_translation_domain ' => array (
559+ 'year ' => 'foo ' ,
560+ 'month ' => 'test ' ,
561+ 'hour ' => 'foo ' ,
562+ 'second ' => 'test ' ,
563+ ),
564+ 'with_seconds ' => true ,
565+ ));
566+
567+ $ view = $ form ->createView ();
568+ $ this ->assertSame ('foo ' , $ view ['date ' ]['year ' ]->vars ['choice_translation_domain ' ]);
569+ $ this ->assertSame ('test ' , $ view ['date ' ]['month ' ]->vars ['choice_translation_domain ' ]);
570+ $ this ->assertFalse ($ view ['date ' ]['day ' ]->vars ['choice_translation_domain ' ]);
571+ $ this ->assertSame ('foo ' , $ view ['time ' ]['hour ' ]->vars ['choice_translation_domain ' ]);
572+ $ this ->assertFalse ($ view ['time ' ]['minute ' ]->vars ['choice_translation_domain ' ]);
573+ $ this ->assertSame ('test ' , $ view ['time ' ]['second ' ]->vars ['choice_translation_domain ' ]);
574+ }
522575}
0 commit comments