-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkahlan-config.php
More file actions
46 lines (37 loc) · 1.48 KB
/
kahlan-config.php
File metadata and controls
46 lines (37 loc) · 1.48 KB
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
43
44
45
46
<?php
use Kahlan\Filter\Filters;
use Kahlan\Reporter\Coverage;
use Kahlan\Reporter\Coverage\Driver\Phpdbg;
use Kahlan\Reporter\Coverage\Driver\Xdebug;
use Kahlan\Reporter\Coverage\Exporter\Clover;
$commandLine = $this->commandLine();
$commandLine->option('ff', 'default', 1);
$commandLine->option('coverage-clover', 'default', 'clover.xml');
Filters::apply($this, 'reporting', function ($next) {
// Get the reporter called `'coverage'` from the list of reporters
$reporter = $this->reporters()->get('coverage');
// Abort if no coverage is available.
if (! $reporter || ! $this->commandLine()->exists('coverage-clover')) {
return $next();
}
// Use the `Coveralls` class to write the JSON coverage into a file
Clover::write([
'collector' => $reporter,
'file' => $this->commandLine()->get('coverage-clover'),
]);
return $next();
});
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'),
'colors' => ! $this->commandLine()->get('no-colors'),
]);
$reporters->add('coverage', $coverage);
});
require_once realpath(rtrim(getcwd(), '\\/ ')).DIRECTORY_SEPARATOR.'spec'.DIRECTORY_SEPARATOR.'bootstrap.php';