Replace @test with prefixed function
class SomeTest extends \PHPUnit\Framework\TestCase
{
- public function testOnePlusOneShouldBeTwo()
+ #[Test]
+ public function onePlusOneShouldBeTwo()
{
$this->assertSame(2, 1+1);
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\ReplaceTestFunctionPrefixWithAttributeRector;
return RectorConfig::configure()
->withRules([
ReplaceTestFunctionPrefixWithAttributeRector::class,
]);