mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-22 18:54:39 +01:00
[Architecture] Add failing test for #700
This commit is contained in:
parent
dbdf0b82cf
commit
86614bba3a
@ -0,0 +1,17 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeInterface;
|
||||
use JMS\DiExtraBundle\Annotation as DI;
|
||||
|
||||
class ClassWithInjects7
|
||||
{
|
||||
/**
|
||||
* @var SomeInterface
|
||||
*/
|
||||
private $session;
|
||||
|
||||
public function __construct(SomeInterface $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
/**
|
||||
* @covers \Rector\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector
|
||||
*/
|
||||
final class JmsRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideWrongToFixedFiles()
|
||||
*/
|
||||
public function test(string $wrong, string $fixed): void
|
||||
{
|
||||
$this->doTestFileMatchesExpectedContent($wrong, $fixed);
|
||||
}
|
||||
|
||||
public function provideWrongToFixedFiles(): Iterator
|
||||
{
|
||||
yield [__DIR__ . '/Wrong/wrong7.php.inc', __DIR__ . '/Correct/correct7.php.inc'];
|
||||
}
|
||||
|
||||
protected function provideConfig(): string
|
||||
{
|
||||
return __DIR__ . '/jms-config.yml';
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeInterface;
|
||||
use JMS\DiExtraBundle\Annotation as DI;
|
||||
|
||||
class ClassWithInjects7
|
||||
{
|
||||
/**
|
||||
* @var SomeInterface
|
||||
* @DI\Inject("irelevant")
|
||||
*/
|
||||
private $session;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
services:
|
||||
Rector\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector:
|
||||
$annotation: 'JMS\DiExtraBundle\Annotation\Inject'
|
Loading…
x
Reference in New Issue
Block a user