I'm trying to use a Data Provider in my PHP test. I'm getting this error:
There was 1 error:
- TaskRunnerTest::testGetCountryIdByName ArgumentCountError: Too few arguments to function TaskRunnerTest::testGetCountryIdByName(), 0 passed in /app/cmd-app/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 1182 and exactly 2 expected
Here is my test:
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class TaskRunnerTest extends TestCase
{
...
#[DataProvider('apiCountryNamesProvider')]
public function testGetCountryIdByName(string $apiCountryName, string $dbCountryName): void
{
// Configure the stub.
$this->dbStub->expects($this->once())
->method('getCountryIdByName')
->with($this->equalTo($dbCountryName));
// test
$this->taskRunner->getCountryIdByName($apiCountryName);
}
...
public static function apiCountryNamesProvider(): array
{
return [
["Saudi-Arabia", "Saudi Arabia"],
];
}
}
I'm using PHPUnit version 11 (packages.lock):
{
"name": "phpunit/phpunit",
"version": "11.0.4",
...
What am I doing wrong?