Turns assert() calls in tests to PHPUnit assert method alternative
use PHPUnit\Framework\TestCase;
class SomeClass extends TestCase
{
public function test()
{
$value = 1000;
- assert($value === 1000, 'message');
+
+ $this->assertSame(1000, $value, "message")
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector;
return RectorConfig::configure()
->withRules([
AssertFuncCallToPHPUnitAssertRector::class,
]);