mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-05 10:50:48 +00:00
improve RectorFactory test and DeprecationDetector
This commit is contained in:
parent
6d2d12b9b7
commit
60e92328ca
|
@ -8,6 +8,7 @@ use PhpParser\Node\Expr\ConstFetch;
|
|||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
use Rector\Node\Attribute;
|
||||
use Rector\TriggerExtractor\Deprecation\DeprecationCollector;
|
||||
use Rector\TriggerExtractor\Deprecation\DeprecationFactory;
|
||||
|
||||
|
@ -39,6 +40,10 @@ final class DeprecationDetector extends NodeVisitorAbstract
|
|||
return;
|
||||
}
|
||||
|
||||
// current scopde would be great
|
||||
dump($node->getAttribute(Attribute::PARENT_NODE)->getParent);
|
||||
die;
|
||||
|
||||
/** @var FuncCall $node */
|
||||
$deprecation = $this->deprecationFactory->createFromNode($node->args[0]->value);
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace Rector\TriggerExtractor\Tests\Rector;
|
||||
|
||||
use PHPUnit\Framework\Assert;
|
||||
use Rector\Tests\AbstractContainerAwareTestCase;
|
||||
use Rector\TriggerExtractor\Rector\ConfigurableChangeMethodNameRector;
|
||||
use Rector\TriggerExtractor\Rector\RectorFactory;
|
||||
use Rector\TriggerExtractor\TriggerExtractor;
|
||||
|
||||
|
@ -24,6 +26,26 @@ final class RectorFactoryTest extends AbstractContainerAwareTestCase
|
|||
public function test(): void
|
||||
{
|
||||
$rectors = $this->rectorFactory->createRectors();
|
||||
$this->assertCount(1, $rectors);
|
||||
$this->assertCount(2, $rectors);
|
||||
|
||||
/** @var ConfigurableChangeMethodNameRector $firstRector */
|
||||
$firstRector = $rectors[0];
|
||||
$this->assertInstanceOf(ConfigurableChangeMethodNameRector::class, $firstRector);
|
||||
|
||||
$this->assertSame([
|
||||
'Nette\DI\Definition' => [
|
||||
'setClass' => 'setFactory'
|
||||
]
|
||||
], Assert::getObjectAttribute($firstRector, 'perClassOldToNewMethod'));
|
||||
|
||||
/** @var ConfigurableChangeMethodNameRector $secondRector */
|
||||
$secondRector = $rectors[1];
|
||||
$this->assertInstanceOf(ConfigurableChangeMethodNameRector::class, $secondRector);
|
||||
|
||||
$this->assertSame([
|
||||
'Nette\DI\Definition' => [
|
||||
'setInject' => 'addTag'
|
||||
]
|
||||
], Assert::getObjectAttribute($secondRector, 'perClassOldToNewMethod'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user