1 | <?php |
||
5 | class TestListener extends \PHPUnit_Util_Printer implements \PHPUnit_Framework_TestListener |
||
6 | { |
||
7 | /** |
||
8 | * Teamcity service message names |
||
9 | */ |
||
10 | const MESSAGE_SUITE_STARTED = 'testSuiteStarted'; |
||
11 | const MESSAGE_SUITE_FINISHED = 'testSuiteFinished'; |
||
12 | const MESSAGE_TEST_STARTED = 'testStarted'; |
||
13 | const MESSAGE_TEST_FAILED = 'testFailed'; |
||
14 | const MESSAGE_TEST_IGNORED = 'testIgnored'; |
||
15 | const MESSAGE_TEST_FINISHED = 'testFinished'; |
||
16 | |||
17 | /** |
||
18 | * Comparison failure message type |
||
19 | */ |
||
20 | const MESSAGE_COMPARISON_FAILURE = 'comparisonFailure'; |
||
21 | |||
22 | /** |
||
23 | * If true, all the standard output (and standard error) messages |
||
24 | * received between testStarted and testFinished messages will be considered test output |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $captureStandardOutput = 'true'; |
||
29 | |||
30 | /** |
||
31 | * Create and write service message to out |
||
32 | * |
||
33 | * @param string $type |
||
34 | * @param \PHPUnit_Framework_Test $test |
||
35 | * @param array $params |
||
36 | */ |
||
37 | 14 | protected function writeServiceMessage($type, \PHPUnit_Framework_Test $test, array $params = array()) |
|
42 | |||
43 | /** |
||
44 | * Create service message |
||
45 | * |
||
46 | * @param string $type |
||
47 | * @param \PHPUnit_Framework_Test $test |
||
48 | * @param array $params |
||
49 | * @return string |
||
50 | */ |
||
51 | 14 | protected function createServiceMessage($type, \PHPUnit_Framework_Test $test, array $params = array()) |
|
64 | |||
65 | /** |
||
66 | * Create timestamp for service message |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 14 | protected function getTimestamp() |
|
76 | |||
77 | /** |
||
78 | * @param \PHPUnit_Framework_Test $test |
||
79 | * @return string |
||
80 | */ |
||
81 | 14 | protected function getTestName(\PHPUnit_Framework_Test $test) |
|
94 | |||
95 | /** |
||
96 | * @param \PHPUnit_Framework_Test $test |
||
97 | * @return int |
||
98 | */ |
||
99 | 14 | protected function getFlowId(\PHPUnit_Framework_Test $test) |
|
103 | |||
104 | /** |
||
105 | * @param string $string |
||
106 | * @return string |
||
107 | */ |
||
108 | 14 | protected function escapeValue($string) |
|
123 | |||
124 | /** |
||
125 | * An error occurred. |
||
126 | * |
||
127 | * @param \PHPUnit_Framework_Test $test |
||
128 | * @param \Exception $e |
||
129 | * @param float $time |
||
130 | */ |
||
131 | 4 | public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time) |
|
155 | |||
156 | /** |
||
157 | * A failure occurred. |
||
158 | * |
||
159 | * @param \PHPUnit_Framework_Test|\PHPUnit_Framework_TestCase $test |
||
160 | * @param \PHPUnit_Framework_AssertionFailedError $e |
||
161 | * @param float $time |
||
162 | */ |
||
163 | 2 | public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time) |
|
167 | |||
168 | /** |
||
169 | * Incomplete test. |
||
170 | * |
||
171 | * @param \PHPUnit_Framework_Test $test |
||
172 | * @param \Exception $e |
||
173 | * @param float $time |
||
174 | */ |
||
175 | 1 | public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) |
|
179 | |||
180 | /** |
||
181 | * Risky test. |
||
182 | * |
||
183 | * @param \PHPUnit_Framework_Test $test |
||
184 | * @param \Exception $e |
||
185 | * @param float $time |
||
186 | * @since Method available since Release 4.0.0 |
||
187 | */ |
||
188 | 1 | public function addRiskyTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) |
|
192 | |||
193 | /** |
||
194 | * Skipped test. |
||
195 | * |
||
196 | * @param \PHPUnit_Framework_Test $test |
||
197 | * @param \Exception $e |
||
198 | * @param float $time |
||
199 | */ |
||
200 | 3 | public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) |
|
210 | |||
211 | /** |
||
212 | * A failure occurred. |
||
213 | * |
||
214 | * @param \PHPUnit_Framework_Test $test |
||
215 | * @param \PHPUnit_Framework_Warning $e |
||
216 | * @param float $time |
||
217 | */ |
||
218 | 1 | public function addWarning(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_Warning $e, $time) |
|
233 | |||
234 | |||
235 | /** |
||
236 | * A test suite started. |
||
237 | * |
||
238 | * @param \PHPUnit_Framework_TestSuite $suite |
||
239 | */ |
||
240 | 2 | public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) |
|
247 | |||
248 | /** |
||
249 | * A test suite ended. |
||
250 | * |
||
251 | * @param \PHPUnit_Framework_TestSuite $suite |
||
252 | */ |
||
253 | 2 | public function endTestSuite(\PHPUnit_Framework_TestSuite $suite) |
|
260 | |||
261 | /** |
||
262 | * A test started. |
||
263 | * |
||
264 | * @param \PHPUnit_Framework_Test $test |
||
265 | */ |
||
266 | 3 | public function startTest(\PHPUnit_Framework_Test $test) |
|
276 | |||
277 | /** |
||
278 | * A test ended. |
||
279 | * |
||
280 | * @param \PHPUnit_Framework_Test $test |
||
281 | * @param float $time seconds |
||
282 | */ |
||
283 | 2 | public function endTest(\PHPUnit_Framework_Test $test, $time) |
|
293 | } |
||
294 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.