[tests] move AbstractReconstructorTestCase to src/Testing

This commit is contained in:
TomasVotruba 2017-07-15 19:03:14 +02:00
parent 764ce4bb08
commit 7446ce99c6
3 changed files with 12 additions and 36 deletions

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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
{