Skip to content

DX: filtering tests by "data provider name" vs. index #6260

@staabm

Description

@staabm

depending on how a dataprovider is keyed, the --filter parameter needs to be provided in a different format:

namely @ vs. # formatted


for a dataprovider with named keys:

function provideData(): iterable {
  yield['my name' => 1];
}

--filter "testSuiteSorterDefectsWithDataProviderTest@my name"

the corresponding test error is

2) PHPUnit\TestFixture\FaillingDataProviderTest::testWithProvider with data set "my name" (1)

=> I think it would be useful if the error message would contain @my name instead of just my name, to ease building the filter param


for a dataprovider with indexed keys:

function provideData(): iterable {
  yield[1];
}

--filter "testSuiteSorterDefectsWithDataProviderTest#1"

the corresponding test error is

PHPUnit\TestFixture\FaillingDataProviderTest::testWithProvider with data set #1 (1)

=> here its easy to remember we can run the test with #1 because the error message tells me so

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions