Use a data provider to run the same test against multiple independent cases: ~~~php /** * @dataProvider statusProvider */ public function testFormatsStatus(string $status, string $expected): void { self::assertSame($expected, StatusFormatter::format($status)); } public static function statusProvider(): array { return [ 'pending' => ['pending', 'Waiting'], 'paid' => ['paid', 'Complete'], ]; } ~~~ On PHPUnit 10+, prefer the equivalent DataProvider attribute and keep cases descriptive.
Installs into .claude/skills of the current project.
Are you the author of Php Testing?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-php-testing-23389433)
Use a data provider to run the same test against multiple independent cases:
~~~php
/**
* @dataProvider statusProvider
*/
public function testFormatsStatus(string $status, string $expected): void
{
self::assertSame($expected, StatusFormatter::format($status));
}
public static function statusProvider(): array
{
return [
'pending' => ['pending', 'Waiting'],
'paid' => ['paid', 'Complete'],
];
}
~~~
On PHPUnit 10+, prefer the equivalent DataProvider attribute and keep cases descriptive.