-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Create individual tests for annotations (#1547)
Resolves: #1546
- Loading branch information
1 parent
a9d3611
commit dd71ee8
Showing
14 changed files
with
179 additions
and
71 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
tests/Rector/v9/v0/IgnoreValidation/IgnoreValidationAnnotationRectorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ssch\TYPO3Rector\Tests\Rector\v9\v0\IgnoreValidation; | ||
|
||
use Iterator; | ||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase; | ||
use Ssch\TYPO3Rector\Rector\v9\v0\IgnoreValidationAnnotationRector; | ||
use Symplify\SmartFileSystem\SmartFileInfo; | ||
|
||
final class IgnoreValidationAnnotationRectorTest extends AbstractRectorTestCase | ||
{ | ||
/** | ||
* @dataProvider provideDataForTest() | ||
*/ | ||
public function test(SmartFileInfo $fileInfo): void | ||
{ | ||
$this->doTestFileInfo($fileInfo); | ||
} | ||
|
||
public function provideDataForTest(): Iterator | ||
{ | ||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
protected function getRectorClass(): string | ||
{ | ||
return IgnoreValidationAnnotationRector::class; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
tests/Rector/v9/v0/InjectAnnotation/Fixture/inject.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace Ssch\TYPO3Rector\Tests\Rector\v9\v0\InjectAnnotation\Fixture; | ||
|
||
final class SomeInjectClass | ||
{ | ||
/** | ||
* @var \Ssch\TYPO3Rector\Tests\Rector\v9\v0\InjectAnnotation\Source\InjectionClass | ||
* @inject | ||
*/ | ||
public $inject2; | ||
/** | ||
* @var \Ssch\TYPO3Rector\Tests\Rector\v9\v0\InjectAnnotation\Source\InjectionClass | ||
* @inject | ||
*/ | ||
private $inject; | ||
|
||
/** | ||
* @var \Ssch\TYPO3Rector\Tests\Rector\v9\v0\InjectAnnotation\Source\InjectionClass | ||
* @inject | ||
*/ | ||
private $inject3; | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Ssch\TYPO3Rector\Tests\Rector\v9\v0\InjectAnnotation\Fixture; | ||
|
||
use Ssch\TYPO3Rector\Tests\Rector\v9\v0\InjectAnnotation\Source\InjectionClass; | ||
final class SomeInjectClass | ||
{ | ||
/** | ||
* @var InjectionClass | ||
* @TYPO3\CMS\Extbase\Annotation\Inject | ||
*/ | ||
public $inject2; | ||
/** | ||
* @var InjectionClass | ||
*/ | ||
private $inject; | ||
|
||
/** | ||
* @var InjectionClass | ||
*/ | ||
private $inject3; | ||
|
||
public function injectInject(InjectionClass $inject): void | ||
{ | ||
$this->inject = $inject; | ||
} | ||
|
||
public function injectInject3(InjectionClass $inject3): void | ||
{ | ||
$this->inject3 = $inject3; | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/Rector/v9/v0/InjectAnnotation/Source/InjectionClass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ssch\TYPO3Rector\Tests\Rector\v9\v0\InjectAnnotation\Source; | ||
|
||
final class InjectionClass | ||
{ | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions
39
tests/Rector/v9/v0/ReplaceAnnotation/ReplaceAnnotationRectorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ssch\TYPO3Rector\Tests\Rector\v9\v0\ReplaceAnnotation; | ||
|
||
use Iterator; | ||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase; | ||
use Ssch\TYPO3Rector\Rector\v9\v0\ReplaceAnnotationRector; | ||
use Symplify\SmartFileSystem\SmartFileInfo; | ||
|
||
final class ReplaceAnnotationRectorTest extends AbstractRectorTestCase | ||
{ | ||
/** | ||
* @dataProvider provideDataForTest() | ||
*/ | ||
public function test(SmartFileInfo $fileInfo): void | ||
{ | ||
$this->doTestFileInfo($fileInfo); | ||
} | ||
|
||
public function provideDataForTest(): Iterator | ||
{ | ||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
protected function getRectorsWithConfiguration(): array | ||
{ | ||
return [ | ||
ReplaceAnnotationRector::class => [ | ||
ReplaceAnnotationRector::OLD_TO_NEW_ANNOTATIONS => [ | ||
'lazy' => 'TYPO3\CMS\Extbase\Annotation\ORM\Lazy', | ||
'cascade' => 'TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")', | ||
'transient' => 'TYPO3\CMS\Extbase\Annotation\ORM\Transient', | ||
], | ||
], | ||
]; | ||
} | ||
} |
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
tests/Rector/v9/v3/ValidateAnnotation/ValidateAnnotationRectorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ssch\TYPO3Rector\Tests\Rector\v9\v3\ValidateAnnotation; | ||
|
||
use Iterator; | ||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase; | ||
use Ssch\TYPO3Rector\Rector\v9\v3\ValidateAnnotationRector; | ||
use Symplify\SmartFileSystem\SmartFileInfo; | ||
|
||
final class ValidateAnnotationRectorTest extends AbstractRectorTestCase | ||
{ | ||
/** | ||
* @dataProvider provideDataForTest() | ||
*/ | ||
public function test(SmartFileInfo $fileInfo): void | ||
{ | ||
$this->doTestFileInfo($fileInfo); | ||
} | ||
|
||
public function provideDataForTest(): Iterator | ||
{ | ||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
protected function getRectorClass(): string | ||
{ | ||
return ValidateAnnotationRector::class; | ||
} | ||
} |