Is there a way to disable code coverage in PHPUnit for a single test?

Since this is one of google top results, I think it makes sense to point out that since version 4.8 PHPUnit now supports the --no-coverage option to override you xml configuration.

https://github.com/sebastianbergmann/phpunit/blob/4.8.0/ChangeLog-4.8.md


How about making a copy of your phpunit.xml, removing the <logging> stanza from it, then doing:

phpunit --configuration new.xml

You can annotate a test class or test method with @coversNothing. The test(s) then do not contribute to the code coverage report. However, code coverage data will still be collected (slowing down the execution). I plan to optimize this in the future.