Skip to content

Filter test case by #<number> does not work with custom data provider key name #4975

Open
@alexander-schranz

Description

@alexander-schranz
Q A
PHPUnit version 9.5.20
PHP version 8.1.4
Installation Method Composer

Summary

I want to filter (--filter) by a specific name. But don't want lost the way to filter by --filter="#2" for example. For this I added #<counter> as a prefix to my key of the data provider validator. But it seems like filter by # is handled specially and does not work in this case.

Current behavior

No tests found for --filter="#5"

How to reproduce

Generator like here: https://github.com/rectorphp/rector-src/pull/2356/files

        $counter = 0;
        foreach (StaticFixtureFinder::yieldDirectoryExclusivelyWithRelativePathname($directory, $suffix) as $name => $parameters) {
            yield '#' . $counter . ' ' . $name => $parameters;

            ++$counter;
        }

Expected behavior

When filtering by vendor/bin/phpunit --filter="#5" the test case with #5 name should be executed.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions