Skip to content
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

SYMFONY_DEPRECATIONS_HELPER has no effect when using the WrapperRunner #793

Closed
MatTheCat opened this issue Oct 4, 2023 · 4 comments · Fixed by #794 or #795
Closed

SYMFONY_DEPRECATIONS_HELPER has no effect when using the WrapperRunner #793

MatTheCat opened this issue Oct 4, 2023 · 4 comments · Fixed by #794 or #795
Labels

Comments

@MatTheCat
Copy link
Contributor

MatTheCat commented Oct 4, 2023

Q A
ParaTest version 6.10.0
PHPUnit version 9.6.12
PHP version 8.2.8

Summary

I wanted to try SYMFONY_DEPRECATIONS_HELPER’s logFile option, but it only worked when I removed the --runner=WrapperRunner option from paratest’s CLI.

How to reproduce: command, code and error stack trace

In your PhpUnit configuration file, add or update SYMFONY_DEPRECATIONS_HELPER as such:

<server name="SYMFONY_DEPRECATIONS_HELPER" value="logFile=var/log/deprecations.test.log" />

then run eg. vendor/bin/paratest --runner=WrapperRunner (I confirmed the --processes option does not make any difference).

Current behavior

The var/log/deprecations.test.log file is not created.

Expected behavior

The var/log/deprecations.test.log file is created and filled with collected deprecations.

@MatTheCat MatTheCat added the bug label Oct 4, 2023
@MatTheCat
Copy link
Contributor Author

It seems when the WrapperRunner is used, PHPUNIT_COMPOSER_INSTALL is not defined when Symfony’s PHPUnit Bridge’s bootstrap runs, thus preventing the registration of the DeprecationErrorHandler. https://github.com/symfony/symfony/blob/9767270b34e97d1bbf340f9ab3358a0178dccb8a/src/Symfony/Bridge/PhpUnit/bootstrap.php#L25

@MatTheCat
Copy link
Contributor Author

Ahah Symfony’s PHPUnit Bridge’s bootstrap is run when the autoloader is required, but phpunit-wrapper sets PHPUNIT_COMPOSER_INSTALL after that.

So switching these two lines fixes my issue:

require_once $file;
define('PHPUNIT_COMPOSER_INSTALL', $file);

@Slamdunk
Copy link
Member

Slamdunk commented Oct 4, 2023

Nice, would you like to create a PR please?

@MatTheCat
Copy link
Contributor Author

That was fast! Thanks 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment