0

When executing PHPUnit with codecoverage, the coverage generating just halts without any error, and no report is generated.

The problem is caused by a fatal error in one file, but it's hard to find what the error is without any error showing up.

I have confirmed display_errors is on, and I have set error_reporting to -1 in php.ini

After much testing with excluding files from coverage, I have found the file in error, and also what the error is (class not implementing inherited abstract methods), but this could have gone faster if I had an actual error.

1 Answer 1

1

The problem was in the PHPUnit config being used.

I had set error reporting like this:

<php>
    <ini name="error_reporting" value="E_ALL & ~E_STRICT" />
</php>

I thought that should work, but it appears that you can only provide constants (E_ALL) or literal values, not expressions like that. This config will set error_reporting to 'E_ALL & ~E_STRICT', instead of the correct numeric value, causing all errors to be muted.

I have solved this by setting error_reporting in the phpunit bootstrap file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.