Skip to content

Commit 5cb8c63

Browse files
committed
test too many/few arguments
1 parent 20d1408 commit 5cb8c63

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

tests/Rules/PHPUnit/DataProviderDataRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ public function testRule(): void
8484
'Parameter #2 $input of method DataProviderDataTest\YieldFromTest::myTestMethod() expects string, false given.',
8585
116,
8686
],
87+
[
88+
'Method DataProviderDataTest\DifferentArgumentCount::testFoo() invoked with 3 parameters, 2 required.',
89+
141,
90+
],
91+
[
92+
'Method DataProviderDataTest\DifferentArgumentCount::testFoo() invoked with 1 parameter, 2 required.',
93+
146,
94+
],
8795
]);
8896
}
8997

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,32 @@ public function yieldProvider(): iterable
121121
}
122122
}
123123

124+
class DifferentArgumentCount extends TestCase
125+
{
126+
127+
/**
128+
* @dataProvider yieldProvider
129+
*/
130+
public function testFoo(string $expectedResult, string $input): void
131+
{
132+
}
133+
134+
public function yieldProvider(): iterable
135+
{
136+
yield from [
137+
[
138+
'Hello World',
139+
" Hello World \n",
140+
],
141+
[
142+
'Hello World',
143+
'abc',
144+
123,
145+
],
146+
[
147+
'Hello World',
148+
]
149+
];
150+
}
151+
}
152+

0 commit comments

Comments
 (0)