1
0
mirror of https://github.com/rectorphp/rector.git synced 2025-04-24 01:14:14 +02:00

[PHPUnit] make ArrayToYieldDataProviderRector cover 'dataProvider' name as well

This commit is contained in:
Tomas Votruba 2018-06-02 16:23:43 +02:00
parent 4603e0b655
commit f680e197ac
3 changed files with 7 additions and 3 deletions
src/Rector/Architecture/PHPUnit
tests/Rector/Architecture/PHPUnit

@ -119,7 +119,11 @@ CODE_SAMPLE
private function isInProvideMethod(ClassMethod $classMethodNode): bool
{
return (bool) Strings::match($classMethodNode->name, '#^provide*#');
if (! $classMethodNode->isPublic()) {
return false;
}
return (bool) Strings::match($classMethodNode->name, '#^(provide|dataProvider)*#');
}
private function hasClassMethodReturnArrayOfArrays(ClassMethod $classMethodNode): bool

@ -6,7 +6,7 @@ use PHPUnit\Framework\TestCase;
final class MyTestCase extends TestCase
{
public function provideWrongToFixedFiles(): \Iterator
public function dataProvider(): \Iterator
{
yield [__DIR__ . '/Wrong/wrong.php.inc', __DIR__ . '/Correct/correct.php.inc'];
}

@ -6,7 +6,7 @@ use PHPUnit\Framework\TestCase;
final class MyTestCase extends TestCase
{
public function provideWrongToFixedFiles(): array
public function dataProvider(): array
{
return [[__DIR__ . '/Wrong/wrong.php.inc', __DIR__ . '/Correct/correct.php.inc']];
}