-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Add support for env, server and ini settings in parallel test runs #28995
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 env, server and ini settings in parallel test runs #28995
Conversation
aaf5916
to
80298a9
Compare
Any hint? /cc @nicolas-grekas |
697ac35
to
f52ec82
Compare
Thats' a pretty big change. Shouldn't we consider it as a new feature? |
@nicolas-grekas did change it to anonymous functions. from my case we can consider it as a new feature, but not sure what to add/change at the documentation because think most people think that the phpunit config variables would also be used in parallel test runs? Could now reproduce and fix the travis ci bug locally by changing the diff --git a/phpunit b/phpunit
index f4b80ed064..e88c75c331 100755
--- a/phpunit
+++ b/phpunit
@@ -11,4 +11,5 @@ if (\PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
}
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
-require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
+require __DIR__.'/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit'; Should we maybe use always the simple-phpunit from repository not from vendor to avoid this kind of problems for contributors?
|
b95c00c
to
0a205e8
Compare
nope, the reason being that we want to use the latest version of the bridge to test the lowest maintained Symfony versions (2.8 for now, so PHP 5.3.3 should still be supported). |
if (false !== $value = getenv($name)) { | ||
return $value; | ||
} | ||
global $argv, $argc, $PHP, $getEnvVar; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about passing them as contexts for functions rather than using a global
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Taluu followed your suggestion and did avoid any usage of global
@nicolas-grekas Using anonymous functions like that and globalizing their containers (variables) like this, I wonder if using the global function scope wouldn't be better... Or maybe adding a namespace in the simple-phpunit file, to restrict these functions in said namespace could be better ? |
bee7bf8
to
a36e29f
Compare
17c4180
to
de5eaf2
Compare
d0bb431
to
fe4e2ba
Compare
7de6e17
to
fe9b089
Compare
fe9b089
to
ef60bdb
Compare
@nicolas-grekas any news to this? |
Please rebase. |
cd48c3d
to
1cebd48
Compare
@nicolas-grekas done. |
1cebd48
to
fb08ec5
Compare
@nicolas-grekas I think we're waiting for you here :) |
fb08ec5
to
8a90931
Compare
@nicolas-grekas if you have time we could have also a look at this at the |
Sure, please rebase meanwhile ;) |
8a90931
to
de43901
Compare
de43901
to
07674a4
Compare
@nicolas-grekas Rebase done ;) |
I feel like the expectations implemented by this PR are wrong, here is why: Try running e.g. Running |
@nicolas-grekas didn't know that the original phpunit allows to give a folder 🙈 thought that was a symfony only feature. Yeah it definitly make sense that the result then is the same as using the original phpunit file. |
Closing as discussed, thanks. |
This fixes problems with $_SERVER and ENV Variables in parallel test runs and that the bootstrap script was not called in parallel test runs.
Currently was most of the logic based on the main phpunit.xml.dist file. This did require me to rewrite the logic based that there are multiple phpunit.xml.dist files. As passing the configuration file via
--configuration
flag phpunit seems correctly read the env and server configuration and use the correct bootstrap file.See with the following test setup which does not work and how this script fixes the errors
https://github.com/alexander-schranz/symfony-phpunit-test.
Checklist: