Skip to content

Commit

Permalink
customising the coverage to exclude all the test files and other file…
Browse files Browse the repository at this point in the history
…s that do not require testing
  • Loading branch information
dogmatic69 committed Aug 10, 2012
1 parent 4f22501 commit edbdf32
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion Test/Case/AllTestsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,34 @@ class AllTestsTest extends PHPUnit_Framework_TestSuite {
* @return void
*/
public static function suite() {
$suite = new CakeTestSuite('All test');
$suite = new static('All Application Tests');
$path = APP . 'Test' . DS . 'Case' . DS;
$suite->addTestFile($path . 'AllCoreTestsTest.php');
$suite->addTestFile($path . 'AllDeveloperTestsTest.php');
$suite->addTestFile($path . 'AllPluginTestsTest.php');
return $suite;
}

public function run(PHPUnit_Framework_TestResult $result = null, $filter = false, array $groups = array(), array $excludeGroups = array(), $processIsolation = false) {
if ($result === null) {
$result = $this->createResult();
}

if (!isset($this->coverageSetup) || !$this->coverageSetup) {
$coverage = $result->getCodeCoverage();
$coverage->setProcessUncoveredFilesFromWhitelist(true);

$coverageFilter = $coverage->filter();

$coverageFilter->addDirectoryToBlacklist(CORE_PATH);
$coverageFilter->addDirectoryToBlacklist(APP . DS . 'Test');
$coverageFilter->addDirectoryToBlacklist(APP . DS . 'Config');
foreach(InfinitasPlugin::listPlugins('all') as $plugin) {
$coverageFilter->addDirectoryToBlacklist(CakePlugin::path($plugin) . 'Test');
}

$this->coverageSetup = true;
}
return parent::run($result, $filter, $groups, $excludeGroups, $processIsolation);
}
}

0 comments on commit edbdf32

Please sign in to comment.