2121
2222final class MissConfigurationReporterTest extends AbstractLazyTestCase
2323{
24- private const string UNUSED_GLOB = '*/UnusedGlobMarker/* ' ;
24+ private const string UNUSED_ENTITY_PATH = '/app/bundles/UserBundle/Entity ' ;
25+
26+ private const string USED_ENTITY_PATH = '/app/bundles/AdminBundle/Entity ' ;
27+
28+ private const string MASK_PATH = '*/SomeMask/* ' ;
2529
2630 private BufferedOutput $ bufferedOutput ;
2731
@@ -44,12 +48,12 @@ protected function setUp(): void
4448 SimpleParameterProvider ::setParameter (Option::SKIP , [
4549 // skip-everywhere rule skip - forgotten at boot, not trackable, must be excluded
4650 ThreeMan::class,
47- // path-scoped class skip, never matched - must be reported
48- FifthElement::class => [' */some/* ' ],
49- // path-scoped class skip, matched - must not be reported
50- AnotherClassToSkip::class => [' */other/* ' ],
51- // glob path skip, never matched - must be reported
52- self ::UNUSED_GLOB ,
51+ // concrete path-scoped class skip, never matched - must be reported
52+ FifthElement::class => [self :: UNUSED_ENTITY_PATH ],
53+ // concrete path-scoped class skip, matched - must not be reported
54+ AnotherClassToSkip::class => [self :: USED_ENTITY_PATH ],
55+ // mask path skip - hard to spot, false-positive prone, must not be reported
56+ self ::MASK_PATH ,
5357 ]);
5458 }
5559
@@ -63,20 +67,23 @@ public function testReportsOnlyTrackableUnusedSkips(): void
6367 {
6468 SimpleParameterProvider ::setParameter (Option::REPORT_UNUSED_SKIPS , true );
6569
66- $ processResult = new ProcessResult ([], [], 0 , [AnotherClassToSkip::class]);
70+ // matched path is marked used by its concrete path, not by the rule class
71+ $ processResult = new ProcessResult ([], [], 0 , [self ::USED_ENTITY_PATH ]);
6772 $ this ->missConfigurationReporter ->reportUnusedSkips ($ processResult );
6873
6974 $ output = $ this ->bufferedOutput ->fetch ();
7075
71- // unused, trackable skips are reported
72- $ this ->assertStringContainsString ('FifthElement ' , $ output );
73- $ this ->assertStringContainsString ('UnusedGlobMarker ' , $ output );
76+ // unused concrete path is reported by path, not rule class
77+ $ this ->assertStringContainsString ('UserBundle ' , $ output );
78+
79+ // matched concrete path is excluded
80+ $ this ->assertStringNotContainsString ('AdminBundle ' , $ output );
81+
82+ // mask path is excluded (hard to spot, false-positive prone)
83+ $ this ->assertStringNotContainsString ('SomeMask ' , $ output );
7484
7585 // skip-everywhere rule skip is excluded (not trackable at runtime)
7686 $ this ->assertStringNotContainsString ('ThreeMan ' , $ output );
77-
78- // matched skip is excluded
79- $ this ->assertStringNotContainsString ('AnotherClassToSkip ' , $ output );
8087 }
8188
8289 public function testReportsNothingWhenDisabled (): void
0 commit comments