Skip to content

Commit aea7e42

Browse files
committed
abstract test-class
1 parent 8491dd7 commit aea7e42

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

src/Rules/PHPUnit/DataProviderDataRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public function processNode(Node $node, Scope $scope): array
8484
if (
8585
$classReflection === null
8686
|| !$classReflection->is(TestCase::class)
87-
|| $classReflection->isAbstract()
8887
) {
8988
return [];
9089
}

tests/Rules/PHPUnit/DataProviderDataRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ public function testRule(): void
163163
'Parameter #1 $si of method DataProviderDataTest\TestWrongTypedIterable::testBar() expects int, string given.',
164164
439,
165165
],
166+
[
167+
'Parameter #2 $input of method DataProviderDataTest\AbstractBaseTest::testWithAttribute() expects string, int given.',
168+
461,
169+
],
170+
[
171+
'Parameter #2 $input of method DataProviderDataTest\AbstractBaseTest::testWithAttribute() expects string, false given.',
172+
461,
173+
],
166174
]);
167175
}
168176

tests/Rules/PHPUnit/data/data-provider-data.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,3 +446,31 @@ public function data(): iterable
446446
{
447447
}
448448
}
449+
450+
451+
abstract class AbstractBaseTest extends TestCase
452+
{
453+
454+
#[DataProvider('aProvider')]
455+
public function testWithAttribute(string $expectedResult, string $input): void
456+
{
457+
}
458+
459+
static public function aProvider(): array
460+
{
461+
return [
462+
[
463+
'Hello World',
464+
" Hello World \n",
465+
],
466+
[
467+
'Hello World',
468+
123,
469+
],
470+
[
471+
'Hello World',
472+
false,
473+
],
474+
];
475+
}
476+
}

0 commit comments

Comments
 (0)