File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace ShipMonk \PHPStan \DeadCode \Provider ;
4+
5+ use PHPStan \Testing \PHPStanTestCase ;
6+ use ReflectionClass ;
7+ use function mkdir ;
8+ use function realpath ;
9+ use function rmdir ;
10+
11+ class SymfonyUsageProviderTest extends PHPStanTestCase
12+ {
13+
14+ public function testAutodetectConfigDir (): void
15+ {
16+ $ configDir = __DIR__ . '/../../config ' ;
17+ @mkdir ($ configDir );
18+
19+ $ provider = new SymfonyUsageProvider (self ::getContainer (), true , null );
20+
21+ $ providerReflection = new ReflectionClass (SymfonyUsageProvider::class);
22+ $ configDirPropertyReflection = $ providerReflection ->getProperty ('configDir ' );
23+ $ configDirPropertyReflection ->setAccessible (true );
24+
25+ $ configDirFromProperty = $ configDirPropertyReflection ->getValue ($ provider );
26+
27+ self ::assertIsString ($ configDirFromProperty );
28+ self ::assertNotFalse (realpath ($ configDir ));
29+ self ::assertNotFalse (realpath ($ configDirFromProperty ));
30+ self ::assertSame (
31+ realpath ($ configDir ),
32+ realpath ($ configDirFromProperty ),
33+ );
34+
35+ @rmdir ($ configDir );
36+ }
37+
38+ }
You can’t perform that action at this time.
0 commit comments