File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,17 @@ function __c3_build_crap4j_report(PHP_CodeCoverage $codeCoverage, $path)
170
170
return $ path . '.crap4j.xml ' ;
171
171
}
172
172
173
+ function __c3_build_cobertura_report (PHP_CodeCoverage $ codeCoverage , $ path )
174
+ {
175
+ if (!class_exists (\SebastianBergmann \CodeCoverage \Report \Cobertura::class)) {
176
+ throw new Exception ("Cobertura report requires php-code-coverage >= 9.2 " );
177
+ }
178
+ $ writer = new \SebastianBergmann \CodeCoverage \Report \Cobertura ();
179
+ $ writer ->process ($ codeCoverage , $ path . '.cobertura.xml ' );
180
+
181
+ return $ path . '.cobertura.xml ' ;
182
+ }
183
+
173
184
function __c3_build_phpunit_report (PHP_CodeCoverage $ codeCoverage , $ path )
174
185
{
175
186
$ writer = new PHP_CodeCoverage_Report_XML (\PHPUnit_Runner_Version::id ());
@@ -339,6 +350,13 @@ function __c3_clear()
339
350
__c3_error ($ e ->getMessage ());
340
351
}
341
352
return __c3_exit ();
353
+ case 'cobertura ' :
354
+ try {
355
+ __c3_send_file (__c3_build_cobertura_report ($ codeCoverage , $ path ));
356
+ } catch (Exception $ e ) {
357
+ __c3_error ($ e ->getMessage ());
358
+ }
359
+ return __c3_exit ();
342
360
}
343
361
} else {
344
362
list ($ codeCoverage , ) = __c3_factory (null );
You can’t perform that action at this time.
0 commit comments