mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
7dfb8dd43d
commit
34ec202c0d
@ -52,6 +52,21 @@ class TestRunner extends Controller {
|
|||||||
'$TestCase' => 'only',
|
'$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.
|
* Override the default reporter with a custom configured subclass.
|
||||||
*
|
*
|
||||||
@ -264,6 +279,10 @@ class TestRunner extends Controller {
|
|||||||
$results->addListener($reporter);
|
$results->addListener($reporter);
|
||||||
|
|
||||||
if($coverage === true) {
|
if($coverage === true) {
|
||||||
|
foreach(self::$coverage_filter_dirs as $dir) {
|
||||||
|
PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
|
||||||
|
}
|
||||||
|
|
||||||
$results->collectCodeCoverageInformation(true);
|
$results->collectCodeCoverageInformation(true);
|
||||||
$suite->run($results);
|
$suite->run($results);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user