Comments (8)
There's no rush, we're just trying to improve the CI pipeline :) Thank you very much.
from phpunit.
I think what @staabm tried to say is that when you use a custom name for a specific data provider iteration like:
yield 'unknown filter' => [
'mixed',
'filter_var($mixed, $mixed)',
];
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 --filter
so that it's not interpreted as a regular expression, but as a request to execute the test for this one specific data provider iteration.
@staabm's theory is that simply doubling \\
is not enough to properly escape the --filter
value.
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.
from phpunit.
I just found #4314 - which described how it should be done.
I was about to comment this:
$ ./tools/phpunit --filter foo --fail-on-empty-test-suite
PHPUnit 11.0.3 by Sebastian Bergmann and contributors.
Runtime: PHP 8.3.3
Configuration: /usr/local/src/raytracer/phpunit.xml
No tests executed!
$ echo $?
1
I just opened #5707 as --fail-on-empty-test-suite
is missing from --help
output.
from phpunit.
We're just interested in how the value passed to --filter
should be sanitized when it comes from an unknown/dynamic source. Is doubling each \
the only thing that needs to be done, or are there other rules to follow?
from phpunit.
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.
from phpunit.
Doubling \
should be enough. Here you can see what PHPUnit does with the value passed to --filter
.
from phpunit.
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.
when using data-providers with a string-key, its possible to use characters like e.g. $
, (
, )
which need escaping in the --filter
option.
Doubling \
is only enough if your filter just contains a class-name and or test-method, but not identifier for the data-provider.
from phpunit.
Do you need something else from me here or can this be closed?
from phpunit.
Related Issues (20)
- TestDox printer does not display details about exceptions raised in before-test methods HOT 5
- Configure GitHub Releases to show "N commits to X.Y since this release" instead of "N commits to main since this release"
- Automatically announce releases on https://phpc.social/@phpunit
- Release nullable type changes for PHPUnit 9.6 HOT 2
- Reading from non-existent file `test-results` in cache folder HOT 4
- DeepCopy\Filter\Filter not found HOT 3
- Get access to the groups in the event system HOT 3
- JUnit XML logger may crash when test that is run in separate process exits unexpectedly HOT 1
- Emit events for `E_*` and `E_USER_*` triggered in data provider methods HOT 2
- Run tests of PHPUnit's own test suite in random order HOT 2
- Deprecations not reported in the summary when running all unit tests HOT 6
- ReturnValueMap is invalid when trying to call with same arguments but different return HOT 1
- Using `@testWith` annotation may generate `PHP Warning: Uninitialized string offset 0` HOT 4
- Best practices/recommendations on how to move from docblock to native annotations HOT 2
- The `#[CoversClass]` and `#[UsesClass]` attributes can no longer target traits HOT 1
- `#[CoversTrait]` and `#[UsesTrait]` attributes
- Deprecate support for targeting traits with `#[CoversClass]` and `#[UsesClass]` attributes
- Remove support for targeting traits with `#[CoversClass]` and `#[UsesClass]` attributes
- https://schema.phpunit.de/11.0/phpunit.xsd not available HOT 1
- `#[CoversMethod]` attribute is not considered for risky test check
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpunit.