1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the doyo/behat-code-coverage 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\Console\ConsoleIO; |
17
|
|
|
use Doyo\Bridge\CodeCoverage\ProcessorInterface; |
18
|
|
|
use Doyo\Bridge\CodeCoverage\TestCase; |
19
|
|
|
use Doyo\Symfony\Bridge\EventDispatcher\Event; |
20
|
|
|
|
21
|
|
|
class CoverageEvent extends Event |
22
|
|
|
{ |
23
|
|
|
const BEFORE_START = 'doyo.coverage.start.pre'; |
24
|
|
|
const BEFORE_STOP = 'doyo.coverage.stop.pre'; |
25
|
|
|
const BEFORE_REFRESH = 'doyo.coverage.refresh.pre'; |
26
|
|
|
const START = 'doyo.coverage.start'; |
27
|
|
|
const STOP = 'doyo.coverage.stop'; |
28
|
|
|
const REFRESH = 'doyo.coverage.refresh'; |
29
|
|
|
const COMPLETED = 'doyo.coverage.completed'; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var TestCase |
33
|
|
|
*/ |
34
|
|
|
private $testCase; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var ProcessorInterface |
38
|
|
|
*/ |
39
|
|
|
private $processor; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var ConsoleIO |
43
|
|
|
*/ |
44
|
|
|
private $consoleIO; |
45
|
|
|
|
46
|
9 |
|
public function __construct(ProcessorInterface $processor, ConsoleIO $consoleIO, TestCase $testCase = null) |
47
|
|
|
{ |
48
|
9 |
|
$this->processor = $processor; |
49
|
9 |
|
$this->testCase = $testCase; |
50
|
9 |
|
$this->consoleIO = $consoleIO; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return TestCase |
55
|
|
|
*/ |
56
|
8 |
|
public function getTestCase(): TestCase |
57
|
|
|
{ |
58
|
8 |
|
return $this->testCase; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return ProcessorInterface |
63
|
|
|
*/ |
64
|
4 |
|
public function getProcessor(): ProcessorInterface |
65
|
|
|
{ |
66
|
4 |
|
return $this->processor; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return ConsoleIO |
71
|
|
|
*/ |
72
|
1 |
|
public function getConsoleIO(): ConsoleIO |
73
|
|
|
{ |
74
|
1 |
|
return $this->consoleIO; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|