Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit --no-coverage option to overwrite config file

I use PHPUnit to test my projects, using a phpunit.xml.dist config file.

The default configuration for all my projects is set to generate html code coverage reports.

Is there anyway I can run the phpunit command at a given time without generating the code coverage reports without having to change the config file?

This would be something like a --no-coverage option.

like image 741
Daniel Ribeiro Avatar asked May 20 '13 17:05

Daniel Ribeiro


People also ask

What is PHPUnit XML file?

PHPUnit uses XML file for configuration. This configuration file can be added to your version control system so all developers get the same output. These settings will help you make sure your tests work the way you want.

What is the PHPUnit XML configuration file used to organize tests?

The <testsuite> Element.


2 Answers

As noted by Gonçalo Queirós in this answer, the --no-coverage option is supported since version 4.8.

like image 120
Derek Avatar answered Sep 18 '22 10:09

Derek


I couldn't find anything from the documentation to reference any sort of functionality that would provide the option to be a toggle.

You could point PHPunit to a second phpunit.xml that doesn't have the code coverage

You can see this very question being asked prior.

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

like image 35
ckdarby Avatar answered Sep 21 '22 10:09

ckdarby