forked from sebastianbergmann/phpunit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogging.php
More file actions
272 lines (222 loc) · 6.76 KB
/
Copy pathLogging.php
File metadata and controls
272 lines (222 loc) · 6.76 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TextUI\Configuration\Logging;
use PHPUnit\TextUI\Configuration\Exception;
use PHPUnit\TextUI\Configuration\Logging\CodeCoverage\Clover;
use PHPUnit\TextUI\Configuration\Logging\CodeCoverage\Crap4j;
use PHPUnit\TextUI\Configuration\Logging\CodeCoverage\Html as CodeCoverageHtml;
use PHPUnit\TextUI\Configuration\Logging\CodeCoverage\Php;
use PHPUnit\TextUI\Configuration\Logging\CodeCoverage\Text as CodeCoverageText;
use PHPUnit\TextUI\Configuration\Logging\CodeCoverage\Xml as CodeCoverageXml;
use PHPUnit\TextUI\Configuration\Logging\TestDox\Html as TestDoxHtml;
use PHPUnit\TextUI\Configuration\Logging\TestDox\Text as TestDoxText;
use PHPUnit\TextUI\Configuration\Logging\TestDox\Xml as TestDoxXml;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @psalm-immutable
*/
final class Logging
{
/**
* @var ?Clover
*/
private $codeCoverageClover;
/**
* @var ?Crap4j
*/
private $codeCoverageCrap4j;
/**
* @var ?CodeCoverageHtml
*/
private $codeCoverageHtml;
/**
* @var ?Php
*/
private $codeCoveragePhp;
/**
* @var ?CodeCoverageText
*/
private $codeCoverageText;
/**
* @var ?CodeCoverageXml
*/
private $codeCoverageXml;
/**
* @var ?Junit
*/
private $junit;
/**
* @var ?PlainText
*/
private $plainText;
/**
* @var ?TeamCity
*/
private $teamCity;
/**
* @var ?TestDoxHtml
*/
private $testDoxHtml;
/**
* @var ?TestDoxText
*/
private $testDoxText;
/**
* @var ?TestDoxXml
*/
private $testDoxXml;
public function __construct(?Clover $codeCoverageClover, ?Crap4j $codeCoverageCrap4j, ?CodeCoverageHtml $codeCoverageHtml, ?Php $codeCoveragePhp, ?CodeCoverageText $codeCoverageText, ?CodeCoverageXml $codeCoverageXml, ?Junit $junit, ?PlainText $plainText, ?TeamCity $teamCity, ?TestDoxHtml $testDoxHtml, ?TestDoxText $testDoxText, ?TestDoxXml $testDoxXml)
{
$this->codeCoverageClover = $codeCoverageClover;
$this->codeCoverageCrap4j = $codeCoverageCrap4j;
$this->codeCoverageHtml = $codeCoverageHtml;
$this->codeCoveragePhp = $codeCoveragePhp;
$this->codeCoverageText = $codeCoverageText;
$this->codeCoverageXml = $codeCoverageXml;
$this->junit = $junit;
$this->plainText = $plainText;
$this->teamCity = $teamCity;
$this->testDoxHtml = $testDoxHtml;
$this->testDoxText = $testDoxText;
$this->testDoxXml = $testDoxXml;
}
public function hasCodeCoverageClover(): bool
{
return $this->codeCoverageClover !== null;
}
public function codeCoverageClover(): Clover
{
if ($this->codeCoverageClover === null) {
throw new Exception('Logger "Clover XML" is not configured');
}
return $this->codeCoverageClover;
}
public function hasCodeCoverageCrap4j(): bool
{
return $this->codeCoverageCrap4j !== null;
}
public function codeCoverageCrap4j(): Crap4j
{
if ($this->codeCoverageCrap4j === null) {
throw new Exception('Logger "Crap4j XML" is not configured');
}
return $this->codeCoverageCrap4j;
}
public function hasCodeCoverageHtml(): bool
{
return $this->codeCoverageHtml !== null;
}
public function codeCoverageHtml(): CodeCoverageHtml
{
if ($this->codeCoverageHtml === null) {
throw new Exception('Logger "Code Coverage HTML" is not configured');
}
return $this->codeCoverageHtml;
}
public function hasCodeCoveragePhp(): bool
{
return $this->codeCoveragePhp !== null;
}
public function codeCoveragePhp(): Php
{
if ($this->codeCoveragePhp === null) {
throw new Exception('Logger "Code Coverage PHP" is not configured');
}
return $this->codeCoveragePhp;
}
public function hasCodeCoverageText(): bool
{
return $this->codeCoverageText !== null;
}
public function codeCoverageText(): CodeCoverageText
{
if ($this->codeCoverageText === null) {
throw new Exception('Logger "Code Coverage Text" is not configured');
}
return $this->codeCoverageText;
}
public function hasCodeCoverageXml(): bool
{
return $this->codeCoverageXml !== null;
}
public function codeCoverageXml(): CodeCoverageXml
{
if ($this->codeCoverageXml === null) {
throw new Exception('Logger "Code Coverage XML" is not configured');
}
return $this->codeCoverageXml;
}
public function hasJunit(): bool
{
return $this->junit !== null;
}
public function junit(): Junit
{
if ($this->junit === null) {
throw new Exception('Logger "JUnit XML" is not configured');
}
return $this->junit;
}
public function hasPlainText(): bool
{
return $this->plainText !== null;
}
public function plainText(): PlainText
{
if ($this->plainText === null) {
throw new Exception('Logger "Plain Text" is not configured');
}
return $this->plainText;
}
public function hasTeamCity(): bool
{
return $this->teamCity !== null;
}
public function teamCity(): TeamCity
{
if ($this->teamCity === null) {
throw new Exception('Logger "Team City" is not configured');
}
return $this->teamCity;
}
public function hasTestDoxHtml(): bool
{
return $this->testDoxHtml !== null;
}
public function testDoxHtml(): TestDoxHtml
{
if ($this->testDoxHtml === null) {
throw new Exception('Logger "TestDox HTML" is not configured');
}
return $this->testDoxHtml;
}
public function hasTestDoxText(): bool
{
return $this->testDoxText !== null;
}
public function testDoxText(): TestDoxText
{
if ($this->testDoxText === null) {
throw new Exception('Logger "TestDox Text" is not configured');
}
return $this->testDoxText;
}
public function hasTestDoxXml(): bool
{
return $this->testDoxXml !== null;
}
public function testDoxXml(): TestDoxXml
{
if ($this->testDoxXml === null) {
throw new Exception('Logger "TestDox XML" is not configured');
}
return $this->testDoxXml;
}
}