|
7 | 7 | use Rector\Configuration\Option; |
8 | 8 | use Rector\Configuration\Parameter\SimpleParameterProvider; |
9 | 9 | use Rector\Configuration\VendorMissAnalyseGuard; |
| 10 | +use Rector\Php85\Rector\FuncCall\OrdSingleByteRector; |
| 11 | +use Rector\PostRector\Rector\NameImportingPostRector; |
10 | 12 | use Rector\Reporting\MissConfigurationReporter; |
11 | 13 | use Rector\Reporting\UnusedSkipResolver; |
12 | 14 | use Rector\Testing\PHPUnit\AbstractLazyTestCase; |
13 | 15 | use Rector\Tests\Skipper\Skipper\Fixture\Element\FifthElement; |
14 | 16 | use Rector\Tests\Skipper\Skipper\Fixture\Element\ThreeMan; |
15 | 17 | use Rector\Tests\Skipper\Skipper\Source\AnotherClassToSkip; |
| 18 | +use Rector\Validation\RectorConfigValidator; |
16 | 19 | use Rector\ValueObject\ProcessResult; |
17 | 20 | use Symfony\Component\Console\Input\ArrayInput; |
18 | 21 | use Symfony\Component\Console\Output\BufferedOutput; |
@@ -59,6 +62,38 @@ protected function tearDown(): void |
59 | 62 | { |
60 | 63 | SimpleParameterProvider::setParameter(Option::SKIP, []); |
61 | 64 | SimpleParameterProvider::setParameter(Option::REPORT_UNUSED_SKIPS, false); |
| 65 | + SimpleParameterProvider::setParameter(Option::SKIPPED_NON_RECTOR_CLASSES, []); |
| 66 | + } |
| 67 | + |
| 68 | + public function testReportsSkippedNonRectorClass(): void |
| 69 | + { |
| 70 | + RectorConfigValidator::ensureRectorRulesExist([ |
| 71 | + // not a Rector rule, can never be skipped |
| 72 | + AnotherClassToSkip::class => ['some/path'], |
| 73 | + // Rector rule, must not be reported |
| 74 | + OrdSingleByteRector::class => ['some/path'], |
| 75 | + // post rector rule, must not be reported |
| 76 | + NameImportingPostRector::class => ['some/path'], |
| 77 | + ]); |
| 78 | + |
| 79 | + $this->missConfigurationReporter->reportSkippedNonRectorClasses(); |
| 80 | + |
| 81 | + $output = $this->bufferedOutput->fetch(); |
| 82 | + |
| 83 | + $this->assertStringContainsString('AnotherClassToSkip', $output); |
| 84 | + $this->assertStringNotContainsString('OrdSingleByteRector', $output); |
| 85 | + $this->assertStringNotContainsString('NameImportingPostRector', $output); |
| 86 | + } |
| 87 | + |
| 88 | + public function testReportsNothingOnRectorClassesOnly(): void |
| 89 | + { |
| 90 | + RectorConfigValidator::ensureRectorRulesExist([ |
| 91 | + OrdSingleByteRector::class => ['some/path'], |
| 92 | + ]); |
| 93 | + |
| 94 | + $this->missConfigurationReporter->reportSkippedNonRectorClasses(); |
| 95 | + |
| 96 | + $this->assertSame('', $this->bufferedOutput->fetch()); |
62 | 97 | } |
63 | 98 |
|
64 | 99 | public function testReportsOnlyTrackableUnusedSkips(): void |
|
0 commit comments