Issues (27)

kahlan-config.php (2 issues)

1
<?php
2
use Kahlan\Filter\Filters;
3
use Kahlan\Reporter\Coverage;
4
use Kahlan\Reporter\Coverage\Driver\Xdebug;
5
use Kahlan\Reporter\Coverage\Driver\Phpdbg;
6
use Kahlan\Reporter\Coverage\Exporter\Coveralls;
7
8
$commandLine = $this->commandLine();
9
$commandLine->option('ff', 'default', 1);
10
$commandLine->option('coverage-coveralls', 'default', 'coveralls.json');
11
12
Filters::apply($this, 'reporting', function($next) {
13
14
    // Get the reporter called `'coverage'` from the list of reporters
15
    $reporter = $this->reporters()->get('coverage');
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
16
17
    // Abort if no coverage is available.
18
    if (!$reporter || !$this->commandLine()->exists('coverage-coveralls')) {
19
        return $next();
20
    }
21
22
    // Use the `Coveralls` class to write the JSON coverage into a file
23
    Coveralls::write([
24
        'collector'      => $reporter,
25
        'file'           => $this->commandLine()->get('coverage-coveralls'),
26
        'service_name'   => 'travis-ci',
27
        'service_job_id' => getenv('TRAVIS_JOB_ID') ?: null
28
    ]);
29
30
    return $next();
31
});
32
33
Filters::apply($this, 'coverage', function($next) {
34
    if (!extension_loaded('xdebug') && PHP_SAPI !== 'phpdbg') {
35
        return;
36
    }
37
    $reporters = $this->reporters();
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
38
    $coverage = new Coverage([
39
        'verbosity' => $this->commandLine()->get('coverage'),
40
        'driver'    => PHP_SAPI !== 'phpdbg' ? new Xdebug() : new Phpdbg(),
41
        'path'      => $this->commandLine()->get('src'),
42
        'colors'    => !$this->commandLine()->get('no-colors')
43
    ]);
44
    $reporters->add('coverage', $coverage);
45
});
46
47
require_once realpath(rtrim(getcwd(), '\\/ ')).DIRECTORY_SEPARATOR.'spec'.DIRECTORY_SEPARATOR.'bootstrap.php';
48