File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
tests/PHPStan/Reflection/BetterReflection/SourceLocator Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace PHPStan \Reflection \BetterReflection \SourceLocator ;
4+
5+ use PHPStan \Parser \PhpParserDecorator ;
6+ use PHPStan \Testing \TestCase ;
7+ use Roave \BetterReflection \Reflector \ClassReflector ;
8+ use Roave \BetterReflection \Reflector \FunctionReflector ;
9+ use Roave \BetterReflection \SourceLocator \Ast \Locator ;
10+ use TestSingleFileSourceLocator \AFoo ;
11+
12+ class AutoloadSourceLocatorTest extends TestCase
13+ {
14+
15+ public function testAutoloadEverythingInFile (): void
16+ {
17+ /** @var FunctionReflector $functionReflector */
18+ $ functionReflector = null ;
19+ $ astLocator = new Locator (new PhpParserDecorator ($ this ->getParser ()), function () use (&$ functionReflector ): FunctionReflector {
20+ return $ functionReflector ;
21+ });
22+ $ locator = new AutoloadSourceLocator ($ astLocator );
23+ $ classReflector = new ClassReflector ($ locator );
24+ $ functionReflector = new FunctionReflector ($ locator , $ classReflector );
25+ $ aFoo = $ classReflector ->reflect (AFoo::class);
26+ $ this ->assertSame ('a.php ' , basename ($ aFoo ->getFileName ()));
27+ }
28+
29+ }
You can’t perform that action at this time.
0 commit comments