Symfony’s deprecation warnings while running tests is a great service to keep track with upcoming changes in newer symfony versions.
However these warnings can break your CI/CD pipeline and sometimes you cant fix all deprecation warnings immediatly.
To disable them you can set the ENV var SYMFONY_DEPRECATIONS_HELPER=disabled
and the warnings will not be displayed anymore and CI/CD will pass again.
Update from comments:
does also work and will still show the deprecation warnings count. (Thx Max)
SYMFONY_DEPRECATIONS_HELPER=weak
This was introduced a while ago with this PullRequest and works for symfony >= 3.1.
So for running the tests manually, do like this:
SYMFONY_DEPRECATIONS_HELPER=disabled vendor/bin/phpunit
Or add it to the phpunit.xml
<php>
<ini name="error_reporting" value="-1" />
<env name="KERNEL_CLASS" value="App\Kernel" />
...
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
</php>
With bitbucket pipelines it looks like this:
pipelines:
branches:
master:
- step:
script:
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- SYMFONY_DEPRECATIONS_HELPER=disabled composer test
- composer check-style
I think `weak` instead of `disabled` also does the trick in CI.
But you’ll still get deprecations warnings count…
Use max[self]=0 for SYMFONY_DEPRECATIONS_HELPER to suppress vendor deprecation notices
see https://symfony.com/doc/current/components/phpunit_bridge.html#internal-deprecations