-
Notifications
You must be signed in to change notification settings - Fork 68
/
kahlan-config-github-action.php
42 lines (40 loc) · 1.61 KB
/
kahlan-config-github-action.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
use Kahlan\Filter\Filters;
use Kahlan\Reporter\Coverage;
use Kahlan\Reporter\Coverage\Driver\Xdebug;
use Kahlan\Reporter\Coverage\Driver\Phpdbg;
$commandLine = $this->commandLine();
$commandLine->option('coverage', 'default', 3);
Filters::apply($this, 'coverage', function($next) {
if (!extension_loaded('xdebug') && PHP_SAPI !== 'phpdbg') {
return;
}
$reporters = $this->reporters();
$coverage = new Coverage([
'verbosity' => $this->commandLine()->get('coverage'),
'driver' => PHP_SAPI !== 'phpdbg' ? new Xdebug() : new Phpdbg(),
'path' => $this->commandLine()->get('src'),
'exclude' => [
//Exclude init script
'src/init.php',
'src/functions.php',
//Exclude Workflow from code coverage reporting
'src/Cli/Kahlan.php',
//Exclude coverage classes from code coverage reporting (don't know how to test the tester)
'src/Reporter/Coverage/Collector.php',
'src/Reporter/Coverage/Driver/Xdebug.php',
'src/Reporter/Coverage/Driver/Phpdbg.php',
//Exclude text based reporter classes from code coverage reporting (a bit useless)
'src/Reporter/Dot.php',
'src/Reporter/Bar.php',
'src/Reporter/Verbose.php',
'src/Reporter/Terminal.php',
'src/Reporter/Reporter.php',
'src/Reporter/Coverage.php',
'src/Reporter/Json.php',
'src/Reporter/Tap.php',
],
'colors' => !$this->commandLine()->get('no-colors')
]);
$reporters->add('coverage', $coverage);
});