Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to name #[TestWith] and #[TestWithJson] data sets #5713

Closed
vudaltsov opened this issue Feb 22, 2024 · 2 comments
Closed

Allow to name #[TestWith] and #[TestWithJson] data sets #5713

vudaltsov opened this issue Feb 22, 2024 · 2 comments
Labels
feature/data-provider Data Providers feature/metadata/attributes type/enhancement A new idea that should be implemented

Comments

@vudaltsov
Copy link

If I'm not mistaken, right now there is no way to name inline data sets. I propose to add an optional $name parameter to attributes:

final class DataTest extends TestCase
{
    #[TestWith([0, 0, 0], 'first data set')]
    #[TestWithJson('[0, 1, 1]', 'second data set')]
    public function testAdd(int $a, int $b, int $expected): void
    {
        $this->assertSame($expected, $a + $b);
    }
}
@vudaltsov vudaltsov added the type/enhancement A new idea that should be implemented label Feb 22, 2024
@sebastianbergmann
Copy link
Owner

Was this not implemented in #4964 for PHPUnit 11.0?

@vudaltsov
Copy link
Author

Cool, thanks! Haven't updated yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/data-provider Data Providers feature/metadata/attributes type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants