Skip to content

Commit 1cae77c

Browse files
committed
test annotations
1 parent 415ca3d commit 1cae77c

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

tests/Rules/PHPUnit/DataProviderDataRuleTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,21 @@ public function testRule(): void
4141
{
4242
$this->analyse([__DIR__ . '/data/data-provider-data.php'], [
4343
[
44-
'Parameter #2 $input of method DataProviderDataTest\FooTest::testTrim() expects string, int given.',
44+
'Parameter #2 $input of method DataProviderDataTest\FooTest::testWithAttribute() expects string, int given.',
4545
23,
4646
],
4747
[
48-
'Parameter #2 $input of method DataProviderDataTest\FooTest::testTrim() expects string, false given.',
48+
'Parameter #2 $input of method DataProviderDataTest\FooTest::testWithAttribute() expects string, false given.',
4949
27,
5050
],
51+
[
52+
'Parameter #2 $input of method DataProviderDataTest\BarTest::testWithAnnotation() expects string, int given.',
53+
50,
54+
],
55+
[
56+
'Parameter #2 $input of method DataProviderDataTest\BarTest::testWithAnnotation() expects string, false given.',
57+
54,
58+
],
5159
]);
5260
}
5361

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,34 @@ class FooTest extends TestCase
99
{
1010

1111
#[DataProvider('aProvider')]
12-
public function testTrim(string $expectedResult, string $input): void
12+
public function testWithAttribute(string $expectedResult, string $input): void
13+
{
14+
}
15+
16+
static public function aProvider(): array
17+
{
18+
return [
19+
[
20+
'Hello World',
21+
" Hello World \n",
22+
],
23+
[
24+
'Hello World',
25+
123,
26+
],
27+
[
28+
'Hello World',
29+
false,
30+
],
31+
];
32+
}
33+
}
34+
35+
class BarTest extends TestCase
36+
{
37+
38+
/** @dataProvider aProvider */
39+
public function testWithAnnotation(string $expectedResult, string $input): void
1340
{
1441
}
1542

0 commit comments

Comments
 (0)