0
votes

I have directory structure of Testproject of zend application like

-Source Files
 -application
 -library
   -Zend
 -public
-Test Files
 -application
 -phpunit.xml   

And phpunit.xml configuratio is

<phpunit bootstrap="./bootstrap.php">
    <testsuite name="Application Test Suite">
        <directory>./application</directory>
    </testsuite>
    <!--<testsuite name="Library Test Suite">
        <directory>./library</directory>
    </testsuite>-->

    <filter>
        <!-- If Zend Framework is inside your project's library, uncomment this filter -->

        <whitelist>
            <directory suffix=".php">../../library/Zend</directory>
        </whitelist>

    </filter>
    <logging>

      <log type="coverage-html" target="./log/htmlreport" charset="UTF-8"
        yui="true" highlight="true" lowUpperBound="50" highLowerBound="80"/>
        <log type="json" target="./log/jsonreport.json" charset="UTF-8"/>

    </logging>
</phpunit>

I am invoking phpunit for application.It works fine and code coverage also generated.However I want to exclude library/zend from code coverage.I mean code coverage should not be generated for library folder.I have tried to exclude it but it always generated.is there any misconfiguration in my phpunit.xml file?

1

1 Answers

0
votes

I'd say you should actually add the path for your application folder to the whitelist and not the library.

In many situations white equals "add", "good", "include" and black equals "remove", "bad, "exclude".

Without a filter phphunit would report pretty much everything. Adding a whitelist initially removes everything for coverage and then adds everything from the whitelist (minus any exclude or blacklist).