Closed rela589n closed 3 years ago
Thank you for your report.
Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.
Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.
Actually code inside test case doesn't matter here. It could be just assert that true is true.
/** @dataProvider comparisonDataProvider */
public function testComparesValues(int $first, int $second, string $method): void
{
self::assertNotNull($first);
self::assertNotNull($second);
self::assertNotNull($method);
}
I finally got what the problem is all about.
My code comparisonDataProvider
was like this:
public function comparisonDataProvider()
{
return (new ComparisonProvider());
foreach (
[
[11, 12],
[0, 1],
[2, 1],
[10, 0],
[5, 5],
[31, 31],
] as $pair
) {
foreach (self::COMPARISON_METHODS as $method) {
yield [...$pair, $method];
}
}
}
I moved main body into another class, returned it's instance on the first line. Probably it is related more to PHP, because function has an yield
which will never be executed, which caused such problem. Removing remaining dead code from method fixes things up.
I think this should be described in error message why phpunit is skipping test. It has taken me about an hour to figure out.
composer info | sort
.env
togetenv()
,$_ENV
and$_SERVER
automagically.Summary
There's a test using data provider:
Data provider returns instance of iterator:
Class
ComparisonProvider
located intests/Unit/Provider/ComparisonProvider.php
:Current behavior
Currently test using shown data provider is skipped.
How to reproduce
See code from summary.
Expected behavior
Expected behavior is that test will be executed the same way if code from
\Tests\Unit\Provider\ComparisonProvider::getIterator
was just pasted intocomparisonDataProvider
: