69

I'm new on Symfony and PHPUnit.

I would like to run some tests, there are a lot of deprecation notices. But it does not matter because I'll stay on Symfony 2.8 for now. Do you know if it's possible to remove them?

enter image description here

I try to find out by myself, but it's not working, have you got some ideas for me folks ?

How to remove the deprecation warnings in Symfony 2.7?

Disable deprecated warning in Symfony 2(.7)


EDIT :

Reference to the answer of @LBA

My screenshot is not really about the error of the AsseticBundle, but about the "Remaining deprecation notices (220)". I would like to know if there is a flag somewhere to display, or not, these warnings. I would like to just have the result of my test suit. Is that possible?

cezar
  • 11,616
  • 6
  • 48
  • 84
Chilipote
  • 1,037
  • 1
  • 8
  • 30

3 Answers3

166

Finally found the solution !

Just add

<php>
    <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
</php>

to your phpunit.xml (or any other file that you use to configure phpunit)

Didier Ghys
  • 30,396
  • 9
  • 75
  • 81
Romain Bigz
  • 1,957
  • 1
  • 11
  • 17
25

You can run in terminal

export SYMFONY_DEPRECATIONS_HELPER=weak

Before executing your script. It will disable deprecation notices

Serghei Niculaev
  • 513
  • 7
  • 17
  • 2
    I don't know why but this is the only answer that works for me. When I change the value in the phpunit xml file it is never refreshed and taken in account by the test suite. – COil Mar 06 '18 at 17:36
  • 2
    it might be because you're using something else than phpunit.xml as your configuration file for phpunit – Romain Bigz Nov 30 '18 at 09:58
3

This is a known issue of the AsseticBundle which isn't part of the official Symfony distribution anymore and not ready for 3.0 yet (having some deprecations in the current tagged version - which you can see in your error message).

So please follow and wait for this issue to be solved and update your AsseticBundle when it's ready (or go with the current master of it what I wouldn't recommend to do.

A lot of people trying to upgrade to Symfony 2.8/3.0 have this issue currently.

Link to the Issue on Github

LBA
  • 3,859
  • 2
  • 21
  • 60
  • Alright, thanks a lot, I will follow. But I have edited my question : my concernes was more about the display of the depreciation notices. Do you know if we can decide to display or not theses logs ? – Chilipote Mar 09 '16 at 20:43
  • Sorry, I am not aware of any option to not display it. – LBA Mar 10 '16 at 09:43