O'Reilly logo

Mastering PHP 7 by Branko Ajzele

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Code coverage

The great thing about PHPUnit is its code coverage reporting functionality. We can easily add code coverage to our testing suite just by extending the phpunit.xml file as follows:

<phpunit bootstrap="autoload.php">  <testsuites>    <testsuite name="foggyline">      <directory>src/Foggyline/*/Test/Unit/*</directory>    </testsuite>  </testsuites>  <filter>    <whitelist>      <directory>src/Foggyline/</directory>      <exclude>        <file>src/config.php</file>        <file>src/auth.php</file>        <directory>src/Foggyline/*/Test/</directory>      </exclude>     </whitelist>    <logging>      <log type="coverage-html" target="log/report" lowUpperBound="50"         highLowerBound="80"/>    </logging>  </filter></phpunit>

Here, we added the filter element, with an extra whitelist and logging element. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required