getCoverageStatus()) { // blacklist selected folders from coverage report $modules = $this->moduleDirectories(); foreach(TestRunner::$coverage_filter_dirs as $dir) { if($dir[0] == '*') { $dir = substr($dir, 1); foreach ($modules as $module) { PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir); } } else { PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir); } } $this->getFrameworkTestResults()->collectCodeCoverageInformation(true); } } /** * Overwrites afterRunTests. Creates coverage report and clover report * if required. */ protected function afterRunTests() { if($this->getCoverageStatus()) { if(!file_exists(ASSETS_PATH . '/coverage-report')) { mkdir(ASSETS_PATH . '/coverage-report'); } $ret = PHPUnit_Util_Report::render($this->getFrameworkTestResults(), ASSETS_PATH . '/coverage-report/'); $coverageApp = ASSETS_PATH . '/coverage-report/' . preg_replace('/[^A-Za-z0-9]/','_',preg_replace('/(\/$)|(^\/)/','',Director::baseFolder())) . '.html'; $coverageTemplates = ASSETS_PATH . '/coverage-report/' . preg_replace('/[^A-Za-z0-9]/','_',preg_replace('/(\/$)|(^\/)/','',realpath(TEMP_FOLDER))) . '.html'; echo "
Coverage reports available here:
"; } } }