28
28
use Symfony \Component \DependencyInjection \Tests \Fixtures \Prototype \Foo ;
29
29
use Symfony \Component \DependencyInjection \Tests \Fixtures \Prototype \FooInterface ;
30
30
use Symfony \Component \DependencyInjection \Tests \Fixtures \Prototype \OtherDir \AnotherSub ;
31
+ use Symfony \Component \DependencyInjection \Tests \Fixtures \Prototype \OtherDir \AnotherSub \DeeperBaz ;
31
32
use Symfony \Component \DependencyInjection \Tests \Fixtures \Prototype \OtherDir \Baz ;
32
33
use Symfony \Component \DependencyInjection \Tests \Fixtures \Prototype \Sub \Bar ;
33
34
use Symfony \Component \DependencyInjection \Tests \Fixtures \Prototype \Sub \BarInterface ;
@@ -153,7 +154,8 @@ public function testRegisterClassesWithExcludeAsArray()
153
154
$ this ->assertTrue ($ container ->has (Foo::class));
154
155
$ this ->assertTrue ($ container ->has (Baz::class));
155
156
$ this ->assertFalse ($ container ->has (Bar::class));
156
- $ this ->assertFalse ($ container ->has (DeeperBaz::class));
157
+ $ this ->assertTrue ($ container ->has (DeeperBaz::class));
158
+ $ this ->assertTrue ($ container ->getDefinition (DeeperBaz::class)->hasTag ('container.excluded ' ));
157
159
}
158
160
159
161
public function testNestedRegisterClasses ()
@@ -227,7 +229,7 @@ public function testRegisterClassesWithIncompatibleExclude()
227
229
/**
228
230
* @dataProvider excludeTrailingSlashConsistencyProvider
229
231
*/
230
- public function testExcludeTrailingSlashConsistency (string $ exclude )
232
+ public function testExcludeTrailingSlashConsistency (string $ exclude, string $ excludedId )
231
233
{
232
234
$ container = new ContainerBuilder ();
233
235
$ loader = new TestFileLoader ($ container , new FileLocator (self ::$ fixturesPath .'/Fixtures ' ));
@@ -239,18 +241,19 @@ public function testExcludeTrailingSlashConsistency(string $exclude)
239
241
);
240
242
241
243
$ this ->assertTrue ($ container ->has (Foo::class));
242
- $ this ->assertFalse ($ container ->has (DeeperBaz::class));
244
+ $ this ->assertTrue ($ container ->has ($ excludedId ));
245
+ $ this ->assertTrue ($ container ->getDefinition ($ excludedId )->hasTag ('container.excluded ' ));
243
246
}
244
247
245
248
public function excludeTrailingSlashConsistencyProvider (): iterable
246
249
{
247
- yield ['Prototype/OtherDir/AnotherSub/ ' ];
248
- yield ['Prototype/OtherDir/AnotherSub ' ];
249
- yield ['Prototype/OtherDir/AnotherSub/* ' ];
250
- yield ['Prototype/*/AnotherSub ' ];
251
- yield ['Prototype/*/AnotherSub/ ' ];
252
- yield ['Prototype/*/AnotherSub/* ' ];
253
- yield ['Prototype/OtherDir/AnotherSub/DeeperBaz.php ' ];
250
+ yield ['Prototype/OtherDir/AnotherSub/ ' , AnotherSub::class ];
251
+ yield ['Prototype/OtherDir/AnotherSub ' , AnotherSub::class ];
252
+ yield ['Prototype/OtherDir/AnotherSub/* ' , DeeperBaz::class ];
253
+ yield ['Prototype/*/AnotherSub ' , AnotherSub::class ];
254
+ yield ['Prototype/*/AnotherSub/ ' , AnotherSub::class ];
255
+ yield ['Prototype/*/AnotherSub/* ' , DeeperBaz::class ];
256
+ yield ['Prototype/OtherDir/AnotherSub/DeeperBaz.php ' , DeeperBaz::class ];
254
257
}
255
258
256
259
/**
0 commit comments