- Issue created by @mondrake
- 🇬🇧United Kingdom jonathan1055
This is a good idea. I saw this issue a few days ago, and thought 'yes nice'. But now that I am hitting the PHPUnit deprecations in my work to add attributes, it has become 'yes must' !
- 🇬🇧United Kingdom jonathan1055
Are you saying that we just need to set the environment variable
PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION
to 1 or 0 and the phpunit binary will use that value? I've just looked inrun-tests.sh
and there is no reference to that variable or the--fail-on-phpunit-deprecation
option.I will try it and see what happens.
- Merge request !371#3530202 Option to control failing on PHPUNIT deprecation → (Open) created by jonathan1055
- 🇮🇹Italy mondrake 🇮🇹
No it's a Drupal thing, not PHPUnit.
Drupal's PHPUnit bootstrap script activates DeprecationHandler, that introspects PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION in its
::getConfiguration()
method. That method is invoked byPhpUnitTestRunner::runCommand
that does this// If the deprecation handler bridge is active, we need to fail when there // are deprecations that get reported (i.e. not ignored or expected). $deprecationConfiguration = DeprecationHandler::getConfiguration(); if ($deprecationConfiguration !== FALSE) { $command[] = '--fail-on-deprecation'; if ($deprecationConfiguration['failOnPhpunitDeprecation']) { $command[] = '--fail-on-phpunit-deprecation'; } }
that is, it adds (or not)
--fail-on-phpunit-deprecation
to the PHPUnit CLI sub-process spawned by run-tests.sh. - 🇬🇧United Kingdom jonathan1055
Thanks for that. In #3527579-9: Add #[Group] attributes for Core 11.2 and PHPUnit 11 → I used your suggestion of setting the plain variable
PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: 0
and this does prevent the internal phpunit deprecation log messages. I am also working on making some changes in our downstream test branches to demonstrate the issue.To implement this, we could just add the new variable to the hidden-variables file and document how to use it. But I think it may be better to add our own differently-named variable that we set, and the users can customise, or enter in the pipeline form, then we convert that to the actual value for
PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: 0
in the script. This will give us the ability to add further options or enhancements in future, if they become available. I will add that to the MR and see how it looks.