@@ -68,6 +68,9 @@ public function testAddTaggedTypes()
6868 ), $ extDefinition ->getArgument (1 ));
6969 }
7070
71+ /**
72+ * @group legacy
73+ */
7174 public function testUseCustomAliasIfSet ()
7275 {
7376 $ container = new ContainerBuilder ();
@@ -107,25 +110,20 @@ public function testAddTaggedTypeExtensions()
107110 $ container = new ContainerBuilder ();
108111 $ container ->addCompilerPass (new FormPass ());
109112
110- $ extDefinition = new Definition ('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension ' );
111- $ extDefinition ->setArguments (array (
113+ $ extDefinition = new Definition ('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension ' , array (
112114 new Reference ('service_container ' ),
113115 array (),
114116 array (),
115117 array (),
116118 ));
117119
118- $ definition1 = new Definition ('stdClass ' );
119- $ definition1 ->addTag ('form.type_extension ' , array ('alias ' => 'type1 ' ));
120- $ definition2 = new Definition ('stdClass ' );
121- $ definition2 ->addTag ('form.type_extension ' , array ('alias ' => 'type1 ' ));
122- $ definition3 = new Definition ('stdClass ' );
123- $ definition3 ->addTag ('form.type_extension ' , array ('alias ' => 'type2 ' ));
124-
125120 $ container ->setDefinition ('form.extension ' , $ extDefinition );
126- $ container ->setDefinition ('my.type_extension1 ' , $ definition1 );
127- $ container ->setDefinition ('my.type_extension2 ' , $ definition2 );
128- $ container ->setDefinition ('my.type_extension3 ' , $ definition3 );
121+ $ container ->register ('my.type_extension1 ' , 'stdClass ' )
122+ ->addTag ('form.type_extension ' , array ('extended_type ' => 'type1 ' ));
123+ $ container ->register ('my.type_extension2 ' , 'stdClass ' )
124+ ->addTag ('form.type_extension ' , array ('extended_type ' => 'type1 ' ));
125+ $ container ->register ('my.type_extension3 ' , 'stdClass ' )
126+ ->addTag ('form.type_extension ' , array ('extended_type ' => 'type2 ' ));
129127
130128 $ container ->compile ();
131129
@@ -142,6 +140,41 @@ public function testAddTaggedTypeExtensions()
142140 ), $ extDefinition ->getArgument (2 ));
143141 }
144142
143+ /**
144+ * @group legacy
145+ */
146+ public function testAliasOptionForTaggedTypeExtensions ()
147+ {
148+ $ container = new ContainerBuilder ();
149+ $ container ->addCompilerPass (new FormPass ());
150+
151+ $ extDefinition = new Definition ('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension ' , array (
152+ new Reference ('service_container ' ),
153+ array (),
154+ array (),
155+ array (),
156+ ));
157+
158+ $ container ->setDefinition ('form.extension ' , $ extDefinition );
159+ $ container ->register ('my.type_extension1 ' , 'stdClass ' )
160+ ->addTag ('form.type_extension ' , array ('alias ' => 'type1 ' ));
161+ $ container ->register ('my.type_extension2 ' , 'stdClass ' )
162+ ->addTag ('form.type_extension ' , array ('alias ' => 'type2 ' ));
163+
164+ $ container ->compile ();
165+
166+ $ extDefinition = $ container ->getDefinition ('form.extension ' );
167+
168+ $ this ->assertSame (array (
169+ 'type1 ' => array (
170+ 'my.type_extension1 ' ,
171+ ),
172+ 'type2 ' => array (
173+ 'my.type_extension2 ' ,
174+ ),
175+ ), $ extDefinition ->getArgument (2 ));
176+ }
177+
145178 public function testAddTaggedGuessers ()
146179 {
147180 $ container = new ContainerBuilder ();
0 commit comments