5

I am picking up phpunit. I am at the phpunit.xml file.

I want to understand what does each element do.

<testsuite name="application">
    <directory>application</directory>
</testsuite>

Does the directory refers to the dir containing all the *Test.php files?

<filter>
    <whitelist>
        <directory suffix=".php">../application</directory>
        <exclude>
            <directory suffix=".php">../library</directory>
            <directory suffix=".phtml">../application</directory>
            <file>../application/bootstrap.php</file>
            <file>../application/scripts/doctrine.php</file>
        </exclude>
    </whitelist>
</filter>

The whitelist refers to the application files (not test.php) that are supposed to be covered? So in this example, I am saying I want all php files in ../application to be covered, except php files in ../library, phtml files in ../application, and the bootstrap.php and doctrine.php?

1 Answer 1

4

Not sure what kind of answer you're waiting for, but you seem to be right, in both cases.

For the second point :

  • the idea is to get code coverage for all your PHP files, even those in which there is no tested code : this way, you get some "real" code-coverage (and not only the code coverage on files that are used by tested code).
  • and the exclusions are here so you don't have code-coverage for the frameworks -- there is no point in testing the frameworks, and considering the huge amount of code there are made of, it would influence your code coverage a lot.

For more informations :

Sign up to request clarification or add additional context in comments.

1 Comment

wont blacklist > exclude be the same as whitelist? and whitelist > exclude be blacklist?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.