Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

336
Views
PHPUnit deprecation warning fails test

I'm using PHPUnit 4.8 on a PHP 5.3.29 install. Some of the code in our application makes use of the deprecated mysql_* functionality, and PHPUnit converts the deprecation notices of these instances to exceptions and in turn fails those specific testcases.

Now I've already included the convertErrorsToExceptions="false" in the config.xml but this doesn't seem to help as it's still happening.

Can anyone help shed some light on what might be happening here?

Cheers!

EDIT: Added example files on gist.github.com

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

if you are looking solution for Symfony 3.1 and higher versions, the answer is

<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
about 4 years ago · Santiago Trujillo Report

0

The convertErrorsToExceptions="false" configuration option only controls the conversion of E_ERROR to exceptions. A deprecation is represented as E_DEPRECATED, though.

A configuration option is missing for controlling the conversion of E_DEPRECATED to exceptions. This will be added in PHPUnit 6.2. This will not be backported to PHPUnit 4.8, the version of PHPUnit you are using, as that version has reached its end of life.

In your bootstrap script you can set PHPUnit_Framework_Error_Deprecated::$enabled = false;, though, which will disable the conversion of E_DEPRECATED to exceptions.

about 4 years ago · Santiago Trujillo Report

0

If anyone is looking for a Symfony/Drupal related solution, a quick way can be to set the env variable in your test file(I needed it because deprecation warnings were coming from a third party repo).

putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!