You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class DependencyAndDataProviderComboTest extends TestCase
{
public function provider(): array
{
return [['provider1'], ['provider2']];
}
public function testProducerFirst(): void
{
$this->assertTrue(true);
return 'first';
}
public function testProducerSecond(): void
{
$this->assertTrue(true);
return 'second';
}
/**
* @depends testProducerFirst
* @depends testProducerSecond
* @dataProvider provider
*/
public function testConsumer(): void
{
$this->assertSame(
['provider1', 'first', 'second'],
func_get_args()
);
}
}
# phpunit tests/DependencyAndDataProviderComboTest.php
Fatal error: A void function must not return a value in /workspaces/phpunit-tutorial/www/tests/DependencyAndDataProviderComboTest.php on line 15
How to solve
In tests/DependencyAndDataProviderComboTest.php apply this two fixes
- public function testProducerFirst(): void
+ public function testProducerFirst(): string
- public function testProducerSecond(): void
+ public function testProducerSecond(): string
The text was updated successfully, but these errors were encountered:
ricfio
added a commit
to ricfio/phpunit-documentation-english
that referenced
this issue
Mar 28, 2021
Uh oh!
There was an error while loading. Please reload this page.
Problem
Fatal error: A void function must not return a value in /workspaces/phpunit-tutorial/www/tests/DependencyAndDataProviderComboTest.php on line 15
Fix
master...ricfio:ricfio-patch-2
How to reproduce
Example 2.9 Combination of @depends and @dataProvider in same test
How to solve
In tests/DependencyAndDataProviderComboTest.php apply this two fixes
The text was updated successfully, but these errors were encountered: