-
-
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
No warning when CLI options are used multiple times #5704
Comments
|
Nevermind, I can confirm that I do not, however, think that multiple |
--filter
or --exclude-filter
options are used multiple times
Yeah, I got a little bit obsessed recently with passing the same option multiple times after watching https://www.youtube.com/watch?v=aolI_Rz0ZqY (great talk btw) because |
--filter
or --exclude-filter
options are used multiple times
All long options supported by PHPUnit's CLI test runner can only be used once. For instance, when As a first step, PHPUnit's CLI test runner will be changed (for PHPUnit >= 10.5) to emit a warning when an option is used multiple times. Future work will be done (for PHPUnit >= 11.1) to allow multiple |
Awesome, thanks! |
@sebastianbergmann Is does not seem to be true of the phpunit -c phpunit-something.xml --testsuite=something \
-d memory_limit=1G \
-d app.tests.generate=1 \
-d app.tests.temporal=2024 \
-d app.tests.xxx=yyy \
... And all arguments have always been properly passed, and still do on PHPUnit 10.5.11 (just tested right now to be sure). However, we do have (crappy) custom code in our bootstrap.php file to support this, so maybe that's why it still works ? // https://github.com/sebastianbergmann/phpunit/issues/634
// The upstream issue about passing custom parameters to PHPUnit was closed.
// Let's simply abuse `-d` for now and scan argvs.
/** @var string $arg */
foreach ($_SERVER['argv'] as $arg) {
if (preg_match('/app\.tests\.generate=1/', $arg)) {
$_SERVER['TESTS_GENERATE'] = '1';
}
if (preg_match('/app\.tests\.temporal=([0-9A-Z:\-\/]+)/', $arg)) {
$_SERVER['TESTS_TEMPORAL'] = $matches[1];
}
// ... and on it goes ...
} And then we use |
I meant to write "long options" instead of just "options" in #5704 (comment). I totally forgot about |
Hi, right now it seems from my testing that passing
--filter
multiple times rewrites the previous occurrence so the first--filter
option is silently discarded.I'd like to use
--filter
to be interpreted in a way - "I want to run tests that pass this filter and also tests that pass this other filter". So in this case PHPUnit should run the two tests I specified.Even if you don't want to interpret multiple
--filter
options that way, I think something could be done about the silent discarding.Thank you.
The text was updated successfully, but these errors were encountered: