improve static removal test

This commit is contained in:
TomasVotruba 2020-05-06 16:55:08 +02:00
parent 63c09315ab
commit 85682c412e
2 changed files with 0 additions and 85 deletions

View File

@ -1,63 +0,0 @@
<?php
namespace Rector\RemovingStatic\Tests\Rector\Class_\PassFactoryToEntityRector\Fixture;
use Rector\RemovingStatic\Tests\Rector\Class_\PassFactoryToEntityRector\Source\TurnMeToService;
class SomeClass
{
public function run()
{
return new AnotherClass;
}
}
class AnotherClass
{
public function someFun()
{
return TurnMeToService::someStaticCall();
}
}
?>
-----
<?php
namespace Rector\RemovingStatic\Tests\Rector\Class_\PassFactoryToEntityRector\Fixture;
use Rector\RemovingStatic\Tests\Rector\Class_\PassFactoryToEntityRector\Source\TurnMeToService;
class SomeClass
{
/**
* @var \Rector\RemovingStatic\Tests\Rector\Class_\PassFactoryToEntityRector\Fixture\AnotherClassFactory
*/
private $anotherClassFactory;
public function __construct(\Rector\RemovingStatic\Tests\Rector\Class_\PassFactoryToEntityRector\Fixture\AnotherClassFactory $anotherClassFactory)
{
$this->anotherClassFactory = $anotherClassFactory;
}
public function run()
{
return $this->anotherClassFactory->create();
}
}
class AnotherClass
{
/**
* @var \Rector\RemovingStatic\Tests\Rector\Class_\PassFactoryToEntityRector\Source\TurnMeToService
*/
private $turnMeToService;
public function __construct(\Rector\RemovingStatic\Tests\Rector\Class_\PassFactoryToEntityRector\Source\TurnMeToService $turnMeToService)
{
$this->turnMeToService = $turnMeToService;
}
public function someFun()
{
return $this->turnMeToService->someStaticCall();
}
}
?>

View File

@ -19,23 +19,6 @@ final class PassFactoryToEntityRectorTest extends AbstractRectorTestCase
{
$this->doTestFile($file);
// test factory content
$this->assertFileExists($this->getTempPath() . '/AnotherClassFactory.php');
$this->assertFileEquals(
__DIR__ . '/Source/ExpectedAnotherClassFactory.php',
$this->getTempPath() . '/AnotherClassFactory.php'
);
}
/**
* @dataProvider provideDataMultipleArguments()
*/
public function testMultipleArguments(string $file): void
{
$this->markTestSkipped('Conflicting with previous test() for unknown reason. Works well separately');
$this->doTestFile($file);
// test factory content
$this->assertFileExists($this->getTempPath() . '/AnotherClassWithMoreArgumentsFactory.php');
$this->assertFileEquals(
@ -45,11 +28,6 @@ final class PassFactoryToEntityRectorTest extends AbstractRectorTestCase
}
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideDataMultipleArguments(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/FixtureWithMultipleArguments');
}