ShouldCallParentMethodsRector
PHPUnit based tests should call parent methods (setUp, tearDown)
namespace Drupal\Tests\Rector\Deprecation\PHPUnit\ShouldCallParentMethodsRector\fixture;
use Drupal\KernelTests\KernelTestBase;
final class SetupVoidTest extends KernelTestBase {
protected function setUp(): void
{
+ parent::setUp();
$test = 'doing things';
}
protected function tearDown(): void
{
+ parent::tearDown();
$test = 'doing things';
}
}
Configure your rector.php:
<?php
use DrupalRector\Rector\PHPUnit\ShouldCallParentMethodsRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
ShouldCallParentMethodsRector::class,
]);