Skip to content

Commit 68e65e9

Browse files
committed
test ArrayIterator
1 parent 1532c26 commit 68e65e9

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/Rules/PHPUnit/DataProviderDataRuleTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ public function testRule(): void
146146
'Missing parameter $si (int) in call to method DataProviderDataTest\TestIterable::testBar().',
147147
371,
148148
],
149+
[
150+
'Parameter #1 $i of method DataProviderDataTest\TestArrayIterator::testBar() expects int, int|string given.',
151+
401,
152+
],
153+
[
154+
'Parameter #1 $i of method DataProviderDataTest\TestArrayIterator::testFoo() expects int, int|string given.',
155+
401,
156+
],
157+
[
158+
'Parameter #1 $s1 of method DataProviderDataTest\TestArrayIterator::testFooBar() expects string, int|string given.',
159+
401,
160+
],
149161
]);
150162
}
151163

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,3 +378,31 @@ public function data(): iterable
378378
{
379379
}
380380
}
381+
382+
class TestArrayIterator extends TestCase
383+
{
384+
/** @dataProvider aProvider */
385+
public function testBar(int $i): void
386+
{
387+
}
388+
389+
/** @dataProvider aProvider */
390+
public function testFoo(int $i, string $si): void
391+
{
392+
}
393+
394+
/** @dataProvider aProvider */
395+
public function testFooBar(string $s1, string $s2): void
396+
{
397+
}
398+
399+
public function aProvider(): iterable
400+
{
401+
return new \ArrayIterator([
402+
[1],
403+
[2, "hello"],
404+
["no"],
405+
["no", "yes"],
406+
]);
407+
}
408+
}

0 commit comments

Comments
 (0)