diff --git a/dev/TestRunner.php b/dev/TestRunner.php index e7a6fe104..8aa319272 100644 --- a/dev/TestRunner.php +++ b/dev/TestRunner.php @@ -17,6 +17,7 @@ function hasPhpUnit() { */ if(hasPhpUnit()) { require_once 'PHPUnit/Framework.php'; +require_once 'PHPUnit/Util/Report.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; } @@ -32,6 +33,7 @@ class TestRunner extends Controller { static $url_handlers = array( '' => 'browse', + 'coverage' => 'coverage', '$TestCase' => 'only', ); @@ -80,7 +82,8 @@ class TestRunner extends Controller { echo '
Coverage report available here
"; + + if(!file_exists('../assets/coverage-report')) mkdir('../assets/coverage-report'); + PHPUnit_Util_Report::render($results, '../assets/coverage-report/'); + $coverageApp = Director::baseURL() . 'assets/coverage-report/' . preg_replace('/[^A-Za-z0-9]/','_',preg_replace('/(\/$)|(^\/)/','',Director::baseFolder())) . '.html'; + $coverageTemplates = Director::baseURL() . 'assets/coverage-report/' . preg_replace('/[^A-Za-z0-9]/','_',preg_replace('/(\/$)|(^\/)/','',realpath(TEMP_FOLDER))) . '.html'; + echo "Coverage reports available here:
"; } else { $suite->run($results); - //$testResult = PHPUnit_TextUI_TestRunner::run($suite); } echo '