PHPUnit: Filter only for one testsuite
Asked Answered
Q

1

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?

Quincey answered 21/2, 2013 at 12:0 Comment(0)
M
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>
Multiplicate answered 21/2, 2013 at 12:30 Comment(1)
I don't think it is supported by PHPUnit, also see this questionMultiplicate

© 2022 - 2024 — McMap. All rights reserved.