Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit: Filter only for one testsuite

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?

like image 552
automatix Avatar asked Feb 21 '13 12:02

automatix


1 Answers

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>
like image 89
Bram Gerritsen Avatar answered Sep 27 '22 16:09

Bram Gerritsen