PHPUnit: Filter for only one testuite

In PHPUnit, you can organize tests in different tests:

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

In addition, you can define filters such as

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

Now I would like to combine these two fetaurs. You cannot put the filter tag in testsuite (the filter is simply 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 ?

+7
source share
1 answer

You tried to add a filter to the testsuite tag because in your example it is in the testsuites tag. i.e:

 <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> 
+1
source

All Articles