39
39
use Symfony \Component \DependencyInjection \Tests \Fixtures \PrototypeAsAlias \AliasBarInterface ;
40
40
use Symfony \Component \DependencyInjection \Tests \Fixtures \PrototypeAsAlias \AliasFooInterface ;
41
41
use Symfony \Component \DependencyInjection \Tests \Fixtures \PrototypeAsAlias \WithAsAlias ;
42
+ use Symfony \Component \DependencyInjection \Tests \Fixtures \PrototypeAsAlias \WithAsAliasDevEnv ;
42
43
use Symfony \Component \DependencyInjection \Tests \Fixtures \PrototypeAsAlias \WithAsAliasIdMultipleInterface ;
43
44
use Symfony \Component \DependencyInjection \Tests \Fixtures \PrototypeAsAlias \WithAsAliasInterface ;
44
45
use Symfony \Component \DependencyInjection \Tests \Fixtures \PrototypeAsAlias \WithAsAliasMultiple ;
46
+ use Symfony \Component \DependencyInjection \Tests \Fixtures \PrototypeAsAlias \WithAsAliasProdEnv ;
45
47
use Symfony \Component \DependencyInjection \Tests \Fixtures \Utils \NotAService ;
46
48
47
49
class FileLoaderTest extends TestCase
@@ -174,7 +176,8 @@ public function testRegisterClassesWithExcludeAsArray()
174
176
$ loader ->registerClasses (
175
177
new Definition (),
176
178
'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype \\' ,
177
- 'Prototype/* ' , [
179
+ 'Prototype/* ' ,
180
+ [
178
181
'Prototype/%sub_dir% ' ,
179
182
'Prototype/OtherDir/AnotherSub/DeeperBaz.php ' ,
180
183
]
@@ -348,11 +351,12 @@ public function testRegisterThrowsWithBothWhenAndNotWhenAttribute()
348
351
349
352
/**
350
353
* @dataProvider provideResourcesWithAsAliasAttributes
354
+ * @group debug
351
355
*/
352
- public function testRegisterClassesWithAsAlias (string $ resource , array $ expectedAliases )
356
+ public function testRegisterClassesWithAsAlias (string $ resource , array $ expectedAliases, ? string $ env = null )
353
357
{
354
358
$ container = new ContainerBuilder ();
355
- $ loader = new TestFileLoader ($ container , new FileLocator (self ::$ fixturesPath .'/Fixtures ' ));
359
+ $ loader = new TestFileLoader ($ container , new FileLocator (self ::$ fixturesPath .'/Fixtures ' ), $ env );
356
360
$ loader ->registerClasses (
357
361
(new Definition ())->setAutoconfigured (true ),
358
362
'Symfony\Component\DependencyInjection\Tests\Fixtures\PrototypeAsAlias \\' ,
@@ -374,6 +378,12 @@ public static function provideResourcesWithAsAliasAttributes(): iterable
374
378
AliasBarInterface::class => new Alias (WithAsAliasIdMultipleInterface::class),
375
379
AliasFooInterface::class => new Alias (WithAsAliasIdMultipleInterface::class),
376
380
]];
381
+ yield 'Dev-env specific ' => ['PrototypeAsAlias/{WithAsAliasDevEnv, WithAsAliasProdEnv}.php ' , [
382
+ AliasFooInterface::class => new Alias (WithAsAliasDevEnv::class),
383
+ ], 'dev ' ];
384
+ yield 'Prod-env specific ' => ['PrototypeAsAlias/{WithAsAliasDevEnv, WithAsAliasProdEnv}.php ' , [
385
+ AliasFooInterface::class => new Alias (WithAsAliasProdEnv::class),
386
+ ], 'prod ' ];
377
387
}
378
388
379
389
/**
0 commit comments