I tried the following configuration:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
<testsuites>
<testsuite name="My Test Suite">
<directory suffix=".php">Test/Case/Model</directory>
<exclude>Test/Case/Model/Behavior</exclude>
</testsuite>
</testsuites>
</phpunit>
but it does not exclude the behaviour from coverage report. How to exclude these directories or files from the coverage report?
The <testsuite> Element.
In computer science, code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite. A program with high code coverage has been more thoroughly tested and has a lower chance of containing software bugs than a program with low code coverage.
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.
Refer to the exclude
element phpunit documentation.
Here is an example phpunit.xml
:
<?xml version="1.0" encoding="utf-8"?>
<phpunit>
<filter>
<whitelist>
<directory suffix=".php">../</directory>
<exclude>
<file>../ext_emconf.php</file>
<directory suffix=".php">../tests</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With