summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-07-22 14:31:11 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-07-31 16:55:39 +0200
commitcf7fc454ec1789603b360d69db83faf49b1e3ef1 (patch)
tree4f15ea013cb1af4513f4d5bba3369af5e24d90ac /application/controllers
parent1a39024190329a002be034d29979e1e8e5902607 (diff)
Add code coverage output
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/tools.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/application/controllers/tools.php b/application/controllers/tools.php
index 845597b08..e90ed6d5f 100644
--- a/application/controllers/tools.php
+++ b/application/controllers/tools.php
@@ -88,6 +88,7 @@ class Tools extends MY_Controller {
try {
$test->setTestNamePrefix($method->name." - ");
$test->init();
+ $test->setTestID("{$testcase}->{$method->name}");
$test->{$method->name}();
$test->cleanup();
} catch (\Exception $e) {
@@ -97,10 +98,26 @@ class Tools extends MY_Controller {
}
}
}
+
if ($exitcode == 0) {
$test->done_testing();
} else {
exit($exitcode);
}
}
+
+ function generate_coverage_report()
+ {
+ include APPPATH."../vendor/autoload.php";
+ $coverage = new \SebastianBergmann\CodeCoverage\CodeCoverage();
+ foreach (glob(FCPATH."/test-coverage-data/*") as $file) {
+ $coverage->merge(unserialize(file_get_contents($file)));
+ }
+
+ //$writer = new \SebastianBergmann\CodeCoverage\Report\Text();
+ //print $writer->process($coverage, 'code-coverage-report');
+ $writer = new \SebastianBergmann\CodeCoverage\Report\Html\Facade();
+ print $writer->process($coverage, 'code-coverage-report');
+ print "Report saved to ./code-coverage-report/index.html\n";
+ }
}