mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-26 20:53:31 +00:00
Merge pull request #3555 from rectorphp/implements-renam
implements rename
This commit is contained in:
commit
b0a7417c80
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Entity;
|
||||
|
||||
final class SameClassImplementEntity implements \Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Contract\RandomInterface
|
||||
{
|
||||
public function returnAnother(): \Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Contract\RandomInterface
|
||||
{
|
||||
}
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveEntitiesToEntityDirectoryRector\Source\Contract;
|
||||
namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Contract;
|
||||
|
||||
interface RandomInterface
|
||||
{
|
||||
public function returnAnother(): \Rector\Autodiscovery\Tests\Rector\FileSystem\MoveEntitiesToEntityDirectoryRector\Source\Contract\RandomInterface;
|
||||
public function returnAnother(): \Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Contract\RandomInterface;
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source;
|
||||
|
||||
use Rector\Autodiscovery\Tests\Rector\FileSystem\MoveEntitiesToEntityDirectoryRector\Source\Contract\RandomInterface;
|
||||
use Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Contract\RandomInterface;
|
||||
|
||||
class SomeFactory
|
||||
{
|
||||
public function create(): \Rector\Autodiscovery\Tests\Rector\FileSystem\MoveEntitiesToEntityDirectoryRector\Source\Contract\RandomInterface
|
||||
public function create(): \Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Contract\RandomInterface
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,27 +12,22 @@ final class MoveInterfacesToContractNamespaceDirectoryRectorTest extends Abstrac
|
|||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
* @param string[] $extraFiles
|
||||
* @param string[][] $extraFiles
|
||||
*/
|
||||
public function test(
|
||||
string $originalFile,
|
||||
string $expectedFileLocation,
|
||||
string $expectedFileContent,
|
||||
array $extraFiles = [],
|
||||
?string $extraExpectedFileLocation = null,
|
||||
?string $expectedExtraFileContent = null
|
||||
array $extraFiles = []
|
||||
): void {
|
||||
$this->doTestFile($originalFile, $extraFiles);
|
||||
$this->doTestFile($originalFile, array_keys($extraFiles));
|
||||
|
||||
$this->assertFileExists($expectedFileLocation);
|
||||
$this->assertFileEquals($expectedFileContent, $expectedFileLocation);
|
||||
|
||||
if ($extraExpectedFileLocation !== null) {
|
||||
$this->assertFileExists($extraExpectedFileLocation);
|
||||
|
||||
if ($expectedExtraFileContent !== null) {
|
||||
$this->assertFileEquals($expectedExtraFileContent, $extraExpectedFileLocation);
|
||||
}
|
||||
foreach ($extraFiles as $extraFile) {
|
||||
$this->assertFileExists($extraFile['location']);
|
||||
$this->assertFileEquals($extraFile['content'], $extraFile['location']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,10 +37,18 @@ final class MoveInterfacesToContractNamespaceDirectoryRectorTest extends Abstrac
|
|||
__DIR__ . '/Source/Entity/RandomInterface.php',
|
||||
$this->getFixtureTempDirectory() . '/Source/Contract/RandomInterface.php',
|
||||
__DIR__ . '/Expected/ExpectedRandomInterface.php',
|
||||
// extra file
|
||||
[__DIR__ . '/Source/RandomInterfaceUseCase.php'],
|
||||
$this->getFixtureTempDirectory() . '/Source/RandomInterfaceUseCase.php',
|
||||
__DIR__ . '/Expected/ExpectedRandomInterfaceUseCase.php',
|
||||
// extra files
|
||||
[
|
||||
__DIR__ . '/Source/RandomInterfaceUseCase.php' => [
|
||||
'location' => $this->getFixtureTempDirectory() . '/Source/RandomInterfaceUseCase.php',
|
||||
'content' => __DIR__ . '/Expected/ExpectedRandomInterfaceUseCase.php',
|
||||
],
|
||||
|
||||
__DIR__ . '/Source/Entity/SameClassImplementEntity.php' => [
|
||||
'location' => $this->getFixtureTempDirectory() . '/Source/Entity/SameClassImplementEntity.php',
|
||||
'content' => __DIR__ . '/Expected/Entity/ExpectedSameClassImplementEntity.php',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// skip nette control factory
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveEntitiesToEntityDirectoryRector\Source\Entity;
|
||||
namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Entity;
|
||||
|
||||
interface RandomInterface
|
||||
{
|
||||
public function returnAnother(): \Rector\Autodiscovery\Tests\Rector\FileSystem\MoveEntitiesToEntityDirectoryRector\Source\Entity\RandomInterface;
|
||||
public function returnAnother(): \Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Entity\RandomInterface;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Entity;
|
||||
|
||||
final class SameClassImplementEntity implements RandomInterface
|
||||
{
|
||||
public function returnAnother(): RandomInterface
|
||||
{
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source;
|
||||
|
||||
use Rector\Autodiscovery\Tests\Rector\FileSystem\MoveEntitiesToEntityDirectoryRector\Source\Entity\RandomInterface;
|
||||
use Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\Source\Entity\RandomInterface;
|
||||
|
||||
class SomeFactory
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user