This repository was archived by the owner on Jan 21, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,31 @@ public function testDelegatorsNamedForAliasDoNotApplyToInvokableServiceResolvedV
119
119
self ::assertSame ($ instance , $ container ->get (TestAsset \Service::class));
120
120
}
121
121
122
+ public function testDelegatorsNamedForAliasDoNotApplyToInvokableServiceWithAlias () : void
123
+ {
124
+ $ config = [
125
+ 'invokables ' => [
126
+ 'alias ' => TestAsset \Service::class,
127
+ ],
128
+ 'delegators ' => [
129
+ 'alias ' => [
130
+ TestAsset \DelegatorFactory::class,
131
+ ],
132
+ ],
133
+ ];
134
+
135
+ $ container = $ this ->createContainer ($ config );
136
+
137
+ self ::assertTrue ($ container ->has ('alias ' ));
138
+ $ instance = $ container ->get ('alias ' );
139
+ self ::assertInstanceOf (TestAsset \Service::class, $ instance );
140
+ self ::assertNotInstanceOf (TestAsset \Delegator::class, $ instance );
141
+
142
+ // Now ensure that the instance already retrieved by alias is the same
143
+ // as that when fetched by the canonical service name.
144
+ self ::assertSame ($ instance , $ container ->get (TestAsset \Service::class));
145
+ }
146
+
122
147
public function testDelegatorsDoNotApplyToAliasResolvingToServiceEntry () : void
123
148
{
124
149
$ myService = new TestAsset \Service ();
You can’t perform that action at this time.
0 commit comments