8

In PHPUnit it is posible to organize the tests in different testsuites:

<phpunit bootstrap="Bootstrap.php">
    <testsuites>
        <testsuite name="zf2sandbox">
            <directory>./AlbumTest</directory>
        </testsuite>
    </testsuites>
</phpunit>

Furthermore you can define filters like

<filter>
    <whitelist>
        <directory suffix=".php">/var/www/sandbox/zf2sandbox/module/Album/src/Album/</directory>
    </whitelist>
</filter>

Now I'd like to combine these two fetaures. It's not allowed to put a filter tag into a testsuite (the filter is just ignored).

<phpunit bootstrap="Bootstrap.php">
    <testsuites>
        <testsuite name="zf2sandbox">
            <directory>./AlbumTest</directory>
            <filter>
                <whitelist>
                    <directory suffix=".php">/var/www/sandbox/zf2sandbox/module/Album/src/Album/</directory>
                </whitelist>
            </filter>
        </testsuite>
    </testsuites>
</phpunit>

Is there another way to define filters (whilists, blacklists etc.) for each testsuite?

automatix
  • 14,018
  • 26
  • 105
  • 230

1 Answers1

1

Did you try adding the filter inside the testsuite tag, because in your example it is in the testsuites tag. ie:

<phpunit bootstrap="Bootstrap.php">
    <testsuites>
        <testsuite name="zf2sandbox">
            <directory>./AlbumTest</directory>
            <filter>
                <whitelist>
                    <directory suffix=".php">/var/www/sandbox/zf2sandbox/module/Album/src/Album/</directory>
                </whitelist>
            </filter>
        </testsuite>
    </testsuites>
</phpunit>
Bram Gerritsen
  • 7,178
  • 4
  • 35
  • 45
  • 1
    I don't think it is supported by PHPUnit, also see this [question](http://stackoverflow.com/questions/13672946/codecoverage-with-phpunit-not-generating) – Bram Gerritsen Feb 21 '13 at 13:03