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

Add support for --filter <name>#<dataset> #622

Closed
sebastianbergmann opened this issue Aug 18, 2012 · 3 comments
Closed

Add support for --filter <name>#<dataset> #622

sebastianbergmann opened this issue Aug 18, 2012 · 3 comments

Comments

@sebastianbergmann
Copy link
Owner

Invoking phpunit with --filter testSomething#42 should only run the test method with name testSomething and only for the data set with ID 42.

@edorian
Copy link
Contributor

edorian commented Sep 6, 2012

Currently working ways to run only a single dataset:

phpunit --filter "testAdd with data set #0" DataTest DataProviderTest.php

or using regex:

phpunit --filter "/::testAdd( with data set .*)?$/" DataTest DataProviderTest.php

Taken from: http://stackoverflow.com/a/12202453/285578


Not to say that adding a sane syntax for the feature wouldn't be a good idea of course

@dharkness
Copy link

While # certainly makes it clear that it's the data set "number", this syntax should also support data set "names". Given that, perhaps consider using . as the separator to avoid confusion.

phpunit --filter testAdd.0
phpunit --filter testAdd.negative

Also dot is easier to type. I know . . . I'm very lazy. :)

Bonus points for allowing regular expressions for matching data set names and ranges for numbers. Perhaps both # and . (or a non-regex character) should be used to distinguish the two cases.

phpunit --filter testAdd#2-4
phpunit --filter testAdd@/fail.*/

Yes, this is going way overboard. Just some ideas.

@whatthejeff
Copy link
Contributor

PR #812 is my stab at this one. I tried to solve it with as few code/interface changes as possible. Might be worth a small refactor in the future, though.

whatthejeff added a commit that referenced this issue Sep 1, 2013
Expanded `--filter` to support:

 * `TestClass#1-3`
 * `TestClass#1`
 * `#1-3`
 * `#1`
 * `TestClass@providerName`
 * `TestClass@providerName.*`
 * `@providerName`
 * `@providerName.*`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants