mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
[tests] move AbstractReconstructorTestCase to src/Testing
This commit is contained in:
parent
764ce4bb08
commit
7446ce99c6
@ -1,20 +1,29 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests;
|
||||
namespace Rector\Testing\PHPUnit;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Rector\Contract\Dispatcher\ReconstructorInterface;
|
||||
use Rector\DependencyInjection\ContainerFactory;
|
||||
use Rector\Testing\Application\FileReconstructor;
|
||||
use SplFileInfo;
|
||||
|
||||
abstract class AbstractReconstructorTestCase extends AbstractContainerAwareTestCase
|
||||
abstract class AbstractReconstructorTestCase extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var FileReconstructor
|
||||
*/
|
||||
private $fileReconstructor;
|
||||
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->container = (new ContainerFactory)->create();
|
||||
$this->fileReconstructor = $this->container->get(FileReconstructor::class);
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Rector\DependencyInjection\ContainerFactory;
|
||||
|
||||
abstract class AbstractContainerAwareTestCase extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private static $cachedContainer;
|
||||
|
||||
/**
|
||||
* @param mixed[] $data
|
||||
*/
|
||||
public function __construct(?string $name = null, array $data = [], string $dataName = '')
|
||||
{
|
||||
if (! self::$cachedContainer) {
|
||||
self::$cachedContainer = (new ContainerFactory)->create();
|
||||
}
|
||||
$this->container = self::$cachedContainer;
|
||||
|
||||
parent::__construct($name, $data, $dataName);
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
namespace Rector\Tests\Reconstructor\DependencyInjection;
|
||||
|
||||
use Rector\Reconstructor\DependencyInjection\InjectAnnotationToConstructorReconstructor;
|
||||
use Rector\Tests\AbstractReconstructorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractReconstructorTestCase;
|
||||
|
||||
final class InjectAnnotationToConstructorReconstructorTest extends AbstractReconstructorTestCase
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user