mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 13:51:54 +01:00
qa: rework unit test to use already available project_initializer
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
This commit is contained in:
parent
158f2144b5
commit
990723ce64
@ -3,16 +3,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Psalm\Tests\Internal\Codebase;
|
namespace Psalm\Tests\Internal\Codebase;
|
||||||
|
|
||||||
use Psalm\Codebase;
|
|
||||||
use Psalm\Internal\Codebase\ClassLikes;
|
use Psalm\Internal\Codebase\ClassLikes;
|
||||||
use Psalm\Internal\Codebase\Reflection;
|
|
||||||
use Psalm\Internal\Codebase\Scanner;
|
|
||||||
use Psalm\Internal\Provider\ClassLikeStorageProvider;
|
use Psalm\Internal\Provider\ClassLikeStorageProvider;
|
||||||
use Psalm\Internal\Provider\FileReferenceProvider;
|
|
||||||
use Psalm\Internal\Provider\FileStorageProvider;
|
|
||||||
use Psalm\Internal\Provider\Providers;
|
|
||||||
use Psalm\Internal\Provider\StatementsProvider;
|
|
||||||
use Psalm\Progress\VoidProgress;
|
|
||||||
use Psalm\Storage\ClassLikeStorage;
|
use Psalm\Storage\ClassLikeStorage;
|
||||||
use Psalm\Tests\TestCase;
|
use Psalm\Tests\TestCase;
|
||||||
|
|
||||||
@ -21,98 +13,29 @@ final class ClassLikesTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @var ClassLikes
|
* @var ClassLikes
|
||||||
*/
|
*/
|
||||||
private $classLikes;
|
private $classlikes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ClassLikeStorageProvider
|
* @var ClassLikeStorageProvider
|
||||||
*/
|
*/
|
||||||
private $storageProvider;
|
private $storage_provider;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var FileReferenceProvider
|
|
||||||
*/
|
|
||||||
private $fileReferenceProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var StatementsProvider
|
|
||||||
*/
|
|
||||||
private $statementsProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Scanner
|
|
||||||
*/
|
|
||||||
private $codebaseScanner;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Codebase
|
|
||||||
*/
|
|
||||||
private $codebase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Providers
|
|
||||||
*/
|
|
||||||
private $providers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var VoidProgress
|
|
||||||
*/
|
|
||||||
private $progress;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var FileStorageProvider
|
|
||||||
*/
|
|
||||||
private $fileStorageProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Reflection
|
|
||||||
*/
|
|
||||||
private $reflection;
|
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->storageProvider = new ClassLikeStorageProvider();
|
$this->classlikes = $this->project_analyzer->getCodebase()->classlikes;
|
||||||
$this->fileReferenceProvider = new FileReferenceProvider();
|
$this->storage_provider = $this->project_analyzer->getCodebase()->classlike_storage_provider;
|
||||||
$this->statementsProvider = new StatementsProvider($this->file_provider);
|
|
||||||
$this->providers = new Providers($this->file_provider);
|
|
||||||
$this->progress = new VoidProgress();
|
|
||||||
$this->codebase = new Codebase(
|
|
||||||
$this->testConfig,
|
|
||||||
$this->providers,
|
|
||||||
$this->progress
|
|
||||||
);
|
|
||||||
$this->fileStorageProvider = new FileStorageProvider();
|
|
||||||
$this->reflection = new Reflection(
|
|
||||||
$this->storageProvider,
|
|
||||||
$this->codebase
|
|
||||||
);
|
|
||||||
$this->codebaseScanner = new Scanner(
|
|
||||||
$this->codebase,
|
|
||||||
$this->testConfig,
|
|
||||||
$this->fileStorageProvider,
|
|
||||||
$this->file_provider,
|
|
||||||
$this->reflection,
|
|
||||||
$this->fileReferenceProvider,
|
|
||||||
$this->progress
|
|
||||||
);
|
|
||||||
$this->classLikes = new ClassLikes(
|
|
||||||
$this->testConfig,
|
|
||||||
$this->storageProvider,
|
|
||||||
$this->fileReferenceProvider,
|
|
||||||
$this->statementsProvider,
|
|
||||||
$this->codebaseScanner
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWillDetectClassImplementingAliasedInterface(): void
|
public function testWillDetectClassImplementingAliasedInterface(): void
|
||||||
{
|
{
|
||||||
$this->classLikes->addClassAlias('Foo', 'bar');
|
$this->classlikes->addClassAlias('Foo', 'bar');
|
||||||
|
|
||||||
$classStorage = new ClassLikeStorage('Baz');
|
$classStorage = new ClassLikeStorage('Baz');
|
||||||
$classStorage->class_implements['bar'] = 'Bar';
|
$classStorage->class_implements['bar'] = 'Bar';
|
||||||
|
|
||||||
$this->storageProvider->addMore(['baz' => $classStorage]);
|
$this->storage_provider->addMore(['baz' => $classStorage]);
|
||||||
|
|
||||||
self::assertTrue($this->classLikes->classImplements('Baz', 'Foo'));
|
self::assertTrue($this->classlikes->classImplements('Baz', 'Foo'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user