@@ -233,6 +233,34 @@ public function testTaggedItemAttributes()
233
233
$ this ->assertSame (array_keys ($ expected ), array_keys ($ services ));
234
234
$ this ->assertEquals ($ expected , $ priorityTaggedServiceTraitImplementation ->test ($ tag , $ container ));
235
235
}
236
+
237
+ public function testResolveIndexedTags ()
238
+ {
239
+ $ container = new ContainerBuilder ();
240
+ $ container ->setParameter ('custom_param_service1 ' , 'bar ' );
241
+ $ container ->setParameter ('custom_param_service2 ' , 'baz ' );
242
+ $ container ->setParameter ('custom_param_service2_empty ' , '' );
243
+ $ container ->setParameter ('custom_param_service2_null ' , null );
244
+ $ container ->register ('service1 ' )->addTag ('my_custom_tag ' , ['foo ' => '%custom_param_service1% ' ]);
245
+
246
+ $ definition = $ container ->register ('service2 ' , BarTagClass::class);
247
+ $ definition ->addTag ('my_custom_tag ' , ['foo ' => '%custom_param_service2% ' , 'priority ' => 100 ]);
248
+ $ definition ->addTag ('my_custom_tag ' , ['foo ' => '%custom_param_service2_empty% ' ]);
249
+ $ definition ->addTag ('my_custom_tag ' , ['foo ' => '%custom_param_service2_null% ' ]);
250
+
251
+ $ priorityTaggedServiceTraitImplementation = new PriorityTaggedServiceTraitImplementation ();
252
+
253
+ $ tag = new TaggedIteratorArgument ('my_custom_tag ' , 'foo ' , 'getFooBar ' );
254
+ $ expected = [
255
+ 'baz ' => new TypedReference ('service2 ' , BarTagClass::class),
256
+ 'bar ' => new Reference ('service1 ' ),
257
+ '' => new TypedReference ('service2 ' , BarTagClass::class),
258
+ 'bar_tab_class_with_defaultmethod ' => new TypedReference ('service2 ' , BarTagClass::class),
259
+ ];
260
+ $ services = $ priorityTaggedServiceTraitImplementation ->test ($ tag , $ container );
261
+ $ this ->assertSame (array_keys ($ expected ), array_keys ($ services ));
262
+ $ this ->assertEquals ($ expected , $ priorityTaggedServiceTraitImplementation ->test ($ tag , $ container ));
263
+ }
236
264
}
237
265
238
266
class PriorityTaggedServiceTraitImplementation
0 commit comments