Replace testWith annotation to data provider.
+public function dataProviderSum()
+{
+ return [
+ [0, 0, 0],
+ [0, 1, 1],
+ [1, 0, 1],
+ [1, 1, 3]
+ ];
+}
+
/**
- * @testWith [0, 0, 0]
- * @testWith [0, 1, 1]
- * @testWith [1, 0, 1]
- * @testWith [1, 1, 3]
+ * @dataProvider dataProviderSum
*/
-public function testSum(int $a, int $b, int $expected)
+public function test(int $a, int $b, int $expected)
{
$this->assertSame($expected, $a + $b);
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\Class_\TestWithToDataProviderRector;
return RectorConfig::configure()
->withRules([
TestWithToDataProviderRector::class,
]);