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\Symfony\Event; |
17
|
|
|
use Doyo\Behat\Coverage\Exception\ReportProcessException; |
18
|
|
|
use SebastianBergmann\CodeCoverage\CodeCoverage; |
19
|
|
|
use Symfony\Component\Console\Style\StyleInterface; |
20
|
|
|
|
21
|
|
|
class ReportEvent extends Event |
22
|
|
|
{ |
23
|
|
|
const BEFORE_PROCESS = 'doyo.coverage.report_pre'; |
24
|
|
|
const PROCESS = 'doyo.coverage.report_process'; |
25
|
|
|
const AFTER_PROCESS = 'doyo.coverage.report_post'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var CodeCoverage|null |
29
|
|
|
*/ |
30
|
|
|
private $coverage; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var StyleInterface|null |
34
|
|
|
*/ |
35
|
|
|
private $io; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var ReportProcessException[] |
39
|
|
|
*/ |
40
|
|
|
private $exceptions = []; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return CodeCoverage|null |
44
|
|
|
*/ |
45
|
1 |
|
public function getCoverage() |
46
|
|
|
{ |
47
|
1 |
|
return $this->coverage; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param CodeCoverage $coverage |
52
|
|
|
* |
53
|
|
|
* @return static |
54
|
|
|
*/ |
55
|
1 |
|
public function setCoverage(CodeCoverage $coverage) |
56
|
|
|
{ |
57
|
1 |
|
$this->coverage = $coverage; |
58
|
|
|
|
59
|
1 |
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return StyleInterface|null |
64
|
|
|
*/ |
65
|
1 |
|
public function getIO() |
66
|
|
|
{ |
67
|
1 |
|
return $this->io; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param StyleInterface|null $io |
72
|
|
|
* |
73
|
|
|
* @return static |
74
|
|
|
*/ |
75
|
1 |
|
public function setIO(StyleInterface $io) |
76
|
|
|
{ |
77
|
1 |
|
$this->io = $io; |
78
|
|
|
|
79
|
1 |
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
1 |
|
public function addException(ReportProcessException $exception) |
83
|
|
|
{ |
84
|
1 |
|
$this->exceptions[] = $exception; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return ReportProcessException[] |
89
|
|
|
*/ |
90
|
1 |
|
public function getExceptions() |
91
|
|
|
{ |
92
|
1 |
|
return $this->exceptions; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|