mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Added TestRunner::$coverage_filter_dirs to exclude certain directories from PHPUnit test coverage reports (from r106877)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112542 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
68e98b4ee2
commit
f7e61e0d11
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user