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
PHPUNIT_RESULT_CACHE env variable is not considered anymore #3714
Comments
@sebastianbergmann @reinholdfuereder I will be able to spend time on PHPUnit again, I've been rather absent due to change in job. |
@epdenouden Thanks in advance and looking forward to this little fix! By the way, below is a quick (naive?) attempt written in a non-PHP-editor (so it may be buggy), but it should show one possible approach:
TestRunner.php
DefaultTestResultCache.php
|
While this is IMHO still a bug, this is no more critical (for us), because PhpStorm with versions >= 2019.2.5 (?) implemented the workaround of always adding "--cache-result-file"... |
That does not just happen in PhpStorm. I experience the same when run tests with |
(Filed because of #3587 (comment))
Since the fix for #3587 (in fact see commit 795abc1) released in PHPUnit 8.1.4 it is no more possible to configure the '.phpunit.result.cache' location globally (via
PHPUNIT_RESULT_CACHE
env variable).The reason why we would like to use such a global configuration possibility (instead of asking each developer to configure each of her PhpStorm PHPUnit runner options when executing single tests) is that we are using a PHPUnit PHAR file located on a (CIFS) mount and execution of single PHPUnit Tests via PhpStorm IDE (without configuration file) will always try to create the '.phpunit.result.cache' next to the shared PHPUnit PHAR file (on the share) that succeeds only the very first time and subsequently always leads to rather irritating warning logs like:
In the course of analysing the problem we stumbled over
$_ENV['PHPUNIT_RESULT_CACHE']
:phpunit/src/Runner/DefaultTestResultCache.php
Lines 69 to 77 in 24fc159
... that we initially had hoped to configure (globally on the 'myhost.acme.com') to set to result cache file directory to user-specific non-shared value: however, since the
DefaultTestResultCache
c'tor is never called withnull
anymore, cf.:phpunit/src/TextUI/TestRunner.php
Lines 162 to 179 in 795abc1
... please note especially
phpunit/src/TextUI/TestRunner.php
Line 167 in 795abc1
..., this environment variable cannot be used or is not considered anymore. Actually I think it is not usable anymore since commit 795abc1
(Please note that this problem has not occurred with the previously used PHPUnit version 8.1.2, but presumably there we will have had the problem of #3587, I guess...)
As far as I understand our devs using PhpStorm IDE would now need to always configure something to avoid these warnings, and the most convenient approach might be: (1) removing all existing PHPUnit runners and (2) configuring the PHPUnit runner template with the option to disable the PHPUnit result cache file via
--do-not-cache-result
(that is likePHPUNIT_RESULT_CACHE
env variable also NOT yet documented https://phpunit.readthedocs.io/en/8.1/textui.html by the way) or alternatively to specify the location via--cache-result-file
? Or is there a better way?However, of course I would be very happy if global configuration via
$_ENV['PHPUNIT_RESULT_CACHE']
is supported again, so that our devs would not need to do anything...The text was updated successfully, but these errors were encountered: