-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
how to properly escape a string for use in --filter #5706
Comments
I was about to comment this:
I just opened #5707 as |
We're just interested in how the value passed to |
I honestly do not know and need to research this (ie. look at the code). I do not have time to do that right now, sorry. I might get to it later today, but it's the weekend, you know. TL;DR: I will do my best to get you an answer ASAP. |
There's no rush, we're just trying to improve the CI pipeline :) Thank you very much. |
Doubling |
hey sebastian, thx for doing the research. I think we need to do more escaping, see the very first example in the PR description above. Doubling |
Do you need something else from me here or can this be closed? |
I think what @staabm tried to say is that when you use a custom name for a specific data provider iteration like:
You could use a custom name that looks like a regular expression. And the question is - if we wanted to execute only this test, how should we write the argument for @staabm's theory is that simply doubling We could of course avoid this problem by using simple names for data providers (and I think we do), but if we were for example to publish a general GitHub Action that would promise you to partition your test suite and run it in parallel over multiple jobs, we could not rely on simple names anymore. |
Summary
we try to feed
phpunit --filter
with test-case names which we determine via--list-tests-xml
.we are wondering, how to properly escape our input strings we want to pass to phpunit via
--filter
option.Current behavior
the docs mention the filter is interpreted as a regex, therefore I went with
preg_quote()
, but this didn't work when we use a "full qualified test-case name" which contains a#
.How to reproduce
a test-class like
requires a escaped filter
the escaping required looks like
preg_quote
and it works for the case abovethe following example doesn't work with
preg_quote
:Expected behavior
I wonder how to properly escape the value for the
--filter
option.this would be especially important as when using the wrong filter no tests would be executed.
can we make phpunit return with a non-zero exit code, when a filter is used which does not execute any tests?edit: I just found #4314 - which described how it should be done.
The text was updated successfully, but these errors were encountered: