|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace DF\PHPCoverFish\Common; |
|
4
|
|
|
|
|
5
|
|
|
use DF\PHPCoverFish\Common\Base\BaseCoverFishResult; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class CoverFishResult |
|
9
|
|
|
* |
|
10
|
|
|
* @package DF\PHPCoverFish |
|
11
|
|
|
* @author Patrick Paechnatz <[email protected]> |
|
12
|
|
|
* @copyright 2015 Patrick Paechnatz <[email protected]> |
|
13
|
|
|
* @license http://www.opensource.org/licenses/MIT |
|
14
|
|
|
* @link http://github.com/dunkelfrosch/phpcoverfish/tree |
|
15
|
|
|
* @since class available since Release 0.9.0 |
|
16
|
|
|
* @version 1.0.0 |
|
17
|
|
|
* |
|
18
|
|
|
* @codeCoverageIgnore |
|
19
|
|
|
*/ |
|
20
|
|
|
class CoverFishResult extends BaseCoverFishResult |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @var ArrayCollection |
|
24
|
|
|
*/ |
|
25
|
|
|
private $warnings; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var ArrayCollection |
|
29
|
|
|
*/ |
|
30
|
|
|
private $errors; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var ArrayCollection |
|
34
|
|
|
*/ |
|
35
|
|
|
private $units; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var string |
|
39
|
|
|
*/ |
|
40
|
|
|
private $errorStream = null; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @var string |
|
44
|
|
|
*/ |
|
45
|
|
|
private $failureStream = null; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var string |
|
49
|
|
|
*/ |
|
50
|
|
|
private $infoStream = null; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @var string |
|
54
|
|
|
*/ |
|
55
|
|
|
private $warningStream = null; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return string |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getErrorStream() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->errorStream; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @param string $errorStream |
|
67
|
|
|
*/ |
|
68
|
|
|
public function setErrorStream($errorStream) |
|
69
|
|
|
{ |
|
70
|
|
|
$this->errorStream = $errorStream; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @return string |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getFailureStream() |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->failureStream; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @param string $failureStream |
|
83
|
|
|
*/ |
|
84
|
|
|
public function setFailureStream($failureStream) |
|
85
|
|
|
{ |
|
86
|
|
|
$this->failureStream = $failureStream; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @param string $content |
|
91
|
|
|
*/ |
|
92
|
|
|
public function addFailureToStream($content) |
|
93
|
|
|
{ |
|
94
|
|
|
$this->failureStream .= $content; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @param string $content |
|
99
|
|
|
*/ |
|
100
|
|
|
public function addInfoToStream($content) |
|
101
|
|
|
{ |
|
102
|
|
|
$this->infoStream .= $content; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @param string $content |
|
107
|
|
|
*/ |
|
108
|
|
|
public function addWarningToStream($content) |
|
109
|
|
|
{ |
|
110
|
|
|
$this->warningStream .= $content; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @return string |
|
115
|
|
|
*/ |
|
116
|
|
|
public function getWarningStream() |
|
117
|
|
|
{ |
|
118
|
|
|
return $this->warningStream; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @param string $warningStream |
|
123
|
|
|
*/ |
|
124
|
|
|
public function setWarningStream($warningStream) |
|
125
|
|
|
{ |
|
126
|
|
|
$this->warningStream = $warningStream; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* @return ArrayCollection |
|
131
|
|
|
*/ |
|
132
|
|
|
public function getWarnings() |
|
133
|
|
|
{ |
|
134
|
|
|
return $this->warnings; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* @param CoverFishMessageWarning $warning |
|
139
|
|
|
*/ |
|
140
|
|
|
public function addWarning(CoverFishMessageWarning $warning) |
|
141
|
|
|
{ |
|
142
|
|
|
$this->warnings->add($warning); |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @param CoverFishMessageWarning $warning |
|
147
|
|
|
*/ |
|
148
|
|
|
public function removeWarning(CoverFishMessageWarning $warning) |
|
149
|
|
|
{ |
|
150
|
|
|
$this->warnings->removeElement($warning); |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* clear all warnings |
|
155
|
|
|
*/ |
|
156
|
|
|
public function clearWarnings() |
|
157
|
|
|
{ |
|
158
|
|
|
$this->warnings->clear(); |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
/** |
|
162
|
|
|
* @return ArrayCollection |
|
163
|
|
|
*/ |
|
164
|
|
|
public function getErrors() |
|
165
|
|
|
{ |
|
166
|
|
|
return $this->errors; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* @param CoverFishMessageError $error |
|
171
|
|
|
*/ |
|
172
|
|
|
public function addError(CoverFishMessageError $error) |
|
173
|
|
|
{ |
|
174
|
|
|
$this->errors->add($error); |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
/** |
|
178
|
|
|
* @param CoverFishMessageError $error |
|
179
|
|
|
*/ |
|
180
|
|
|
public function removeError(CoverFishMessageError $error) |
|
181
|
|
|
{ |
|
182
|
|
|
$this->errors->removeElement($error); |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @return ArrayCollection |
|
187
|
|
|
*/ |
|
188
|
|
|
public function getUnits() |
|
189
|
|
|
{ |
|
190
|
|
|
return $this->units; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* @param CoverFishPHPUnitFile $file |
|
195
|
|
|
*/ |
|
196
|
|
|
public function addUnit(CoverFishPHPUnitFile $file) |
|
197
|
|
|
{ |
|
198
|
|
|
$this->units->add($file); |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* @param CoverFishPHPUnitFile $file |
|
203
|
|
|
*/ |
|
204
|
|
|
public function removeUnit(CoverFishPHPUnitFile $file) |
|
205
|
|
|
{ |
|
206
|
|
|
$this->units->removeElement($file); |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
|
|
/** |
|
210
|
|
|
* remove all tests from testCollection |
|
211
|
|
|
*/ |
|
212
|
|
|
public function clearUnits() |
|
213
|
|
|
{ |
|
214
|
|
|
$this->units->clear(); |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
/** |
|
218
|
|
|
* clear all errors |
|
219
|
|
|
*/ |
|
220
|
|
|
public function clearErrors() |
|
221
|
|
|
{ |
|
222
|
|
|
$this->errors->clear(); |
|
223
|
|
|
} |
|
224
|
|
|
|
|
225
|
|
|
/** |
|
226
|
|
|
* class constructor |
|
227
|
|
|
*/ |
|
228
|
|
|
public function __construct() |
|
229
|
|
|
{ |
|
230
|
|
|
parent::__construct(); |
|
231
|
|
|
$this->warnings = new ArrayCollection(); |
|
232
|
|
|
$this->errors = new ArrayCollection(); |
|
233
|
|
|
$this->units = new ArrayCollection(); |
|
234
|
|
|
} |
|
235
|
|
|
} |