-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fd3d9c
commit 97617f2
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
tests/PHPStan/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocatorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Reflection\BetterReflection\SourceLocator; | ||
|
||
use PHPStan\Parser\PhpParserDecorator; | ||
use PHPStan\Testing\TestCase; | ||
use Roave\BetterReflection\Reflector\ClassReflector; | ||
use Roave\BetterReflection\Reflector\FunctionReflector; | ||
use Roave\BetterReflection\SourceLocator\Ast\Locator; | ||
use TestSingleFileSourceLocator\AFoo; | ||
|
||
class AutoloadSourceLocatorTest extends TestCase | ||
{ | ||
|
||
public function testAutoloadEverythingInFile(): void | ||
{ | ||
/** @var FunctionReflector $functionReflector */ | ||
$functionReflector = null; | ||
$astLocator = new Locator(new PhpParserDecorator($this->getParser()), function () use (&$functionReflector): FunctionReflector { | ||
return $functionReflector; | ||
}); | ||
$locator = new AutoloadSourceLocator($astLocator); | ||
$classReflector = new ClassReflector($locator); | ||
$functionReflector = new FunctionReflector($locator, $classReflector); | ||
$aFoo = $classReflector->reflect(AFoo::class); | ||
$this->assertSame('a.php', basename($aFoo->getFileName())); | ||
} | ||
|
||
} |