ENHANCEMENT Added TestRunner::$coverage_filter_dirs to exclude certain directories from PHPUnit test coverage reports

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@106877 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-06-22 03:28:27 +00:00 committed by Sam Minnee
parent 7dfb8dd43d
commit 34ec202c0d

View File

@ -52,6 +52,21 @@ class TestRunner extends Controller {
'$TestCase' => 'only',
);
/**
* @var Array Blacklist certain directories for the coverage report.
* Filepaths are relative to the webroot, without leading slash.
*
* @see http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.blacklist-whitelist
*/
static $coverage_filter_dirs = array(
'cms/thirdparty',
'cms/tests',
'cms/lang',
'sapphire/thirdparty',
'sapphire/tests',
'sapphire/lang',
);
/**
* Override the default reporter with a custom configured subclass.
*
@ -264,6 +279,10 @@ class TestRunner extends Controller {
$results->addListener($reporter);
if($coverage === true) {
foreach(self::$coverage_filter_dirs as $dir) {
PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
}
$results->collectCodeCoverageInformation(true);
$suite->run($results);