@@ -89,6 +89,7 @@ public function testRegisterClasses()
89
89
$ container = new ContainerBuilder ();
90
90
$ container ->setParameter ('sub_dir ' , 'Sub ' );
91
91
$ loader = new TestFileLoader ($ container , new FileLocator (self ::$ fixturesPath .'/Fixtures ' ));
92
+ $ loader ->autoRegisterAliasesForSinglyImplementedInterfaces = false ;
92
93
93
94
$ loader ->registerClasses (new Definition (), 'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub \\' , 'Prototype/%sub_dir%/* ' );
94
95
$ loader ->registerClasses (new Definition (), 'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub \\' , 'Prototype/%sub_dir%/* ' ); // loading twice should not be an issue
@@ -121,7 +122,6 @@ public function testRegisterClassesWithExclude()
121
122
// load everything, except OtherDir/AnotherSub & Foo.php
122
123
'Prototype/{%other_dir%/AnotherSub,Foo.php} '
123
124
);
124
- $ loader ->registerAliasesForSinglyImplementedInterfaces ();
125
125
126
126
$ this ->assertTrue ($ container ->has (Bar::class));
127
127
$ this ->assertTrue ($ container ->has (Baz::class));
@@ -151,7 +151,6 @@ public function testRegisterClassesWithExcludeAsArray()
151
151
'Prototype/OtherDir/AnotherSub/DeeperBaz.php ' ,
152
152
]
153
153
);
154
- $ loader ->registerAliasesForSinglyImplementedInterfaces ();
155
154
156
155
$ this ->assertTrue ($ container ->has (Foo::class));
157
156
$ this ->assertTrue ($ container ->has (Baz::class));
@@ -167,7 +166,6 @@ public function testNestedRegisterClasses()
167
166
$ prototype = new Definition ();
168
167
$ prototype ->setPublic (true )->setPrivate (true );
169
168
$ loader ->registerClasses ($ prototype , 'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype \\' , 'Prototype/* ' );
170
- $ loader ->registerAliasesForSinglyImplementedInterfaces ();
171
169
172
170
$ this ->assertTrue ($ container ->has (Bar::class));
173
171
$ this ->assertTrue ($ container ->has (Baz::class));
@@ -199,7 +197,6 @@ public function testMissingParentClass()
199
197
'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses \\' ,
200
198
'Prototype/%bad_classes_dir%/* '
201
199
);
202
- $ loader ->registerAliasesForSinglyImplementedInterfaces ();
203
200
204
201
$ this ->assertTrue ($ container ->has (MissingParent::class));
205
202
@@ -218,7 +215,6 @@ public function testRegisterClassesWithBadPrefix()
218
215
219
216
// the Sub is missing from namespace prefix
220
217
$ loader ->registerClasses (new Definition (), 'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype \\' , 'Prototype/Sub/* ' );
221
- $ loader ->registerAliasesForSinglyImplementedInterfaces ();
222
218
}
223
219
224
220
public function testRegisterClassesWithIncompatibleExclude ()
@@ -234,12 +230,13 @@ public function testRegisterClassesWithIncompatibleExclude()
234
230
'Prototype/* ' ,
235
231
'yaml/* '
236
232
);
237
- $ loader ->registerAliasesForSinglyImplementedInterfaces ();
238
233
}
239
234
}
240
235
241
236
class TestFileLoader extends FileLoader
242
237
{
238
+ public $ autoRegisterAliasesForSinglyImplementedInterfaces = true ;
239
+
243
240
public function load ($ resource , $ type = null )
244
241
{
245
242
return $ resource ;
0 commit comments