File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ public function __construct()
49
49
];
50
50
51
51
$ this ->optimizationPasses = [[
52
+ new AutoAliasServicePass (),
52
53
new ValidateEnvPlaceholdersPass (),
53
54
new ResolveChildDefinitionsPass (),
54
55
new RegisterServiceSubscribersPass (),
Original file line number Diff line number Diff line change @@ -1601,6 +1601,24 @@ public function testWither()
1601
1601
$ wither = $ container ->get ('wither ' );
1602
1602
$ this ->assertInstanceOf (Foo::class, $ wither ->foo );
1603
1603
}
1604
+
1605
+ public function testAutoAliasing ()
1606
+ {
1607
+ $ container = new ContainerBuilder ();
1608
+ $ container ->register (C::class);
1609
+ $ container ->register (D::class);
1610
+
1611
+ $ container ->setParameter ('foo ' , D::class);
1612
+
1613
+ $ definition = new Definition (X::class);
1614
+ $ definition ->setPublic (true );
1615
+ $ definition ->addTag ('auto_alias ' , ['format ' => '%foo% ' ]);
1616
+ $ container ->setDefinition (X::class, $ definition );
1617
+
1618
+ $ container ->compile ();
1619
+
1620
+ $ this ->assertInstanceOf (D::class, $ container ->get (X::class));
1621
+ }
1604
1622
}
1605
1623
1606
1624
class FooClass
@@ -1617,3 +1635,15 @@ public function __construct(A $a)
1617
1635
{
1618
1636
}
1619
1637
}
1638
+
1639
+ interface X
1640
+ {
1641
+ }
1642
+
1643
+ class C implements X
1644
+ {
1645
+ }
1646
+
1647
+ class D implements X
1648
+ {
1649
+ }
You can’t perform that action at this time.
0 commit comments