1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the doyo/behat-coverage-extension project. |
5
|
|
|
* |
6
|
|
|
* (c) Anthonius Munthi <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Doyo\Behat\Coverage\Event; |
15
|
|
|
|
16
|
|
|
use Doyo\Behat\Coverage\Bridge\Aggregate; |
|
|
|
|
17
|
|
|
use Doyo\Behat\Coverage\Bridge\Symfony\Event; |
18
|
|
|
|
19
|
|
|
class CoverageEvent extends Event |
20
|
|
|
{ |
21
|
|
|
const BEFORE_START = 'doyo.coverage.start.pre'; |
22
|
|
|
const BEFORE_STOP = 'doyo.coverage.stop.pre'; |
23
|
|
|
const BEFORE_REFRESH = 'doyo.coverage.refresh.pre'; |
24
|
|
|
const START = 'doyo.coverage.start'; |
25
|
|
|
const STOP = 'doyo.coverage.stop'; |
26
|
|
|
const REFRESH = 'doyo.coverage.refresh'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
private $coverageId; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var array |
35
|
|
|
*/ |
36
|
|
|
private $coverage; |
37
|
|
|
|
38
|
9 |
|
public function __construct($coverageId = null) |
39
|
|
|
{ |
40
|
9 |
|
$this->coverageId = $coverageId; |
41
|
9 |
|
$this->coverage = array(); |
42
|
|
|
} |
43
|
|
|
|
44
|
1 |
|
public function updateCoverage($coverage) |
45
|
|
|
{ |
46
|
1 |
|
$aggregate = $this->coverage; |
47
|
|
|
|
48
|
1 |
|
foreach ($coverage as $class => $counts) { |
49
|
|
|
|
50
|
1 |
|
if(!isset($this->coverage[$class])){ |
51
|
1 |
|
$aggregate[$class] = $counts; |
52
|
1 |
|
continue; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
foreach($counts as $line => $status){ |
56
|
|
|
$status = !$status ? -1 : ($status > 1 ? 1 : $status); |
57
|
|
|
$aggregate[$class][$line] = $status; |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
61
|
1 |
|
$this->coverage = $aggregate; |
62
|
|
|
} |
63
|
|
|
|
64
|
1 |
|
public function setCoverage(array $coverage) |
65
|
|
|
{ |
66
|
1 |
|
$this->coverage = $coverage; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return array |
71
|
|
|
*/ |
72
|
1 |
|
public function getCoverage() |
73
|
|
|
{ |
74
|
1 |
|
return $this->coverage; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return string |
79
|
|
|
*/ |
80
|
1 |
|
public function getCoverageId(): string |
81
|
|
|
{ |
82
|
1 |
|
return $this->coverageId; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @param string|null $coverageId |
87
|
|
|
*/ |
88
|
1 |
|
public function setCoverageId($coverageId=null) |
89
|
|
|
{ |
90
|
1 |
|
$this->coverageId = $coverageId; |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths