Skip to content

Commit 9a0d039

Browse files
committed
separate named args expectations
1 parent 3fc4e0e commit 9a0d039

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

tests/Rules/PHPUnit/DataProviderDataRuleTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,7 @@ public function testRule(): void
128128
318,
129129
],
130130
[
131-
'Unknown parameter $foo in call to method DataProviderDataTest\TestArrayShapeIterable::testBar().',
132-
332,
133-
],
134-
[
135-
'Missing parameter $si (int) in call to method DataProviderDataTest\TestArrayShapeIterable::testBar().',
131+
'Parameter $si of method DataProviderDataTest\TestArrayShapeIterable::testBar() expects int, string given.',
136132
332,
137133
],
138134
[
@@ -193,6 +189,14 @@ public function testRulePhp8(): void
193189
'Parameter $input of method DataProviderDataTestPhp8\NamedArgsInProvider::testFoo() expects string, false given.',
194190
44
195191
],
192+
[
193+
'Unknown parameter $wrong in call to method DataProviderDataTestPhp8\TestArrayShapeIterable::testBar().',
194+
58
195+
],
196+
[
197+
'Missing parameter $si (int) in call to method DataProviderDataTestPhp8\TestArrayShapeIterable::testBar().',
198+
58
199+
],
196200
]);
197201
}
198202

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,24 @@ public function aProvider(): array
4444
return $arr;
4545
}
4646
}
47+
48+
49+
class TestArrayShapeIterable extends TestCase
50+
{
51+
/** @dataProvider aProvider */
52+
public function testBar(int $si): void
53+
{
54+
}
55+
56+
public function aProvider(): iterable
57+
{
58+
return $this->data();
59+
}
60+
61+
/**
62+
* @return iterable<array{wrong: string}>
63+
*/
64+
public function data(): iterable
65+
{
66+
}
67+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public function aProvider(): iterable
333333
}
334334

335335
/**
336-
* @return iterable<array{foo: string}>
336+
* @return iterable<array{si: string}>
337337
*/
338338
public function data(): iterable
339339
{

0 commit comments

Comments
 (0)