-1

I'm trying to make working test suite of very old PHP project (Symfony 2.2.4, PHPUnit 4.8.36).

When i run tests, with command line ./phpunit -c app my/tests/path i got symfony errors like:

bindRequest() is deprecated since version 2.1 and will be removed in 2.3. Use FormInterface::bind() instead. 

I would like run tests without deprecated or strict errors for now. How to do that ?

Note: I don't have phpunit configuration file (and don't know how create it). Note2: my php.ini already have error_reporting set to E_ALL & ~E_DEPRECATED & ~E_STRICT in /etc/php/5.6/cli/php.ini

bux
  • 7,087
  • 11
  • 45
  • 86
  • add to your script "error_reporting(E_ALL & ~(E_STRICT | E_DEPRECATED) ); " – Honk der Hase Sep 20 '18 at 19:46
  • @LarsStegelitz I have this config in my php.ini. You say to add it in the top of file of .php script containg test ? I have a lot of php script with tests. I have to add it in all files ? There is no place to set it once ? – bux Sep 20 '18 at 19:50
  • 1
    Looking at the message it looks more like it comes from the framework, not from PHP itself. – Honk der Hase Sep 20 '18 at 19:58
  • @LarsStegelitz If you think it comes from Symfony, do you know where to configure this ? Note: When run development server, deprecated and stricts don't produce fatal error. – bux Sep 20 '18 at 20:05
  • Have you tried any of these solutions? https://stackoverflow.com/questions/28850809/disable-deprecated-warning-in-symfony-2-7 – Cerad Sep 20 '18 at 20:20
  • @Cerad yes i tried all of these, no change. – bux Sep 20 '18 at 20:34
  • Even the AppKernel::init() method? Seems strange. – Cerad Sep 20 '18 at 21:29
  • @Cerad Yes Even Even the AppKernel::init() method ... I will investigate more – bux Sep 21 '18 at 09:57

1 Answers1

0

Working solution for me: Install this component:

composer require symfony/debug

And add this in AppKernel#init:

if ($this->debug ) {
    Debug::enable(E_RECOVERABLE_ERROR & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED, false);
    // ...
bux
  • 7,087
  • 11
  • 45
  • 86