Completed
Push — master ( 52755b...6c4366 )
by smiley
02:13
created
vendor/phpunit/phpunit/src/Util/Log/TeamCity.php 2 patches
Indentation   +390 added lines, -390 removed lines patch added patch discarded remove patch
@@ -31,394 +31,394 @@
 block discarded – undo
31 31
  */
32 32
 class TeamCity extends ResultPrinter
33 33
 {
34
-    /**
35
-     * @var bool
36
-     */
37
-    private $isSummaryTestCountPrinted = false;
38
-
39
-    /**
40
-     * @var string
41
-     */
42
-    private $startedTestName;
43
-
44
-    /**
45
-     * @var int|false
46
-     */
47
-    private $flowId;
48
-
49
-    /**
50
-     * @param string $progress
51
-     */
52
-    protected function writeProgress($progress)
53
-    {
54
-    }
55
-
56
-    /**
57
-     * @param TestResult $result
58
-     */
59
-    public function printResult(TestResult $result)
60
-    {
61
-        $this->printHeader();
62
-        $this->printFooter($result);
63
-    }
64
-
65
-    /**
66
-     * An error occurred.
67
-     *
68
-     * @param Test       $test
69
-     * @param \Exception $e
70
-     * @param float      $time
71
-     */
72
-    public function addError(Test $test, \Exception $e, $time)
73
-    {
74
-        $this->printEvent(
75
-            'testFailed',
76
-            [
77
-                'name'    => $test->getName(),
78
-                'message' => self::getMessage($e),
79
-                'details' => self::getDetails($e),
80
-            ]
81
-        );
82
-    }
83
-
84
-    /**
85
-     * A warning occurred.
86
-     *
87
-     * @param Test    $test
88
-     * @param Warning $e
89
-     * @param float   $time
90
-     */
91
-    public function addWarning(Test $test, Warning $e, $time)
92
-    {
93
-        $this->printEvent(
94
-            'testFailed',
95
-            [
96
-                'name'    => $test->getName(),
97
-                'message' => self::getMessage($e),
98
-                'details' => self::getDetails($e)
99
-            ]
100
-        );
101
-    }
102
-
103
-    /**
104
-     * A failure occurred.
105
-     *
106
-     * @param Test                 $test
107
-     * @param AssertionFailedError $e
108
-     * @param float                $time
109
-     */
110
-    public function addFailure(Test $test, AssertionFailedError $e, $time)
111
-    {
112
-        $parameters = [
113
-            'name'    => $test->getName(),
114
-            'message' => self::getMessage($e),
115
-            'details' => self::getDetails($e),
116
-        ];
117
-
118
-        if ($e instanceof ExpectationFailedException) {
119
-            $comparisonFailure = $e->getComparisonFailure();
120
-
121
-            if ($comparisonFailure instanceof ComparisonFailure) {
122
-                $expectedString = $comparisonFailure->getExpectedAsString();
123
-
124
-                if (null === $expectedString || empty($expectedString)) {
125
-                    $expectedString = self::getPrimitiveValueAsString($comparisonFailure->getExpected());
126
-                }
127
-
128
-                $actualString = $comparisonFailure->getActualAsString();
129
-
130
-                if (null === $actualString || empty($actualString)) {
131
-                    $actualString = self::getPrimitiveValueAsString($comparisonFailure->getActual());
132
-                }
133
-
134
-                if (null !== $actualString && null !== $expectedString) {
135
-                    $parameters['type']     = 'comparisonFailure';
136
-                    $parameters['actual']   = $actualString;
137
-                    $parameters['expected'] = $expectedString;
138
-                }
139
-            }
140
-        }
141
-
142
-        $this->printEvent('testFailed', $parameters);
143
-    }
144
-
145
-    /**
146
-     * Incomplete test.
147
-     *
148
-     * @param Test       $test
149
-     * @param \Exception $e
150
-     * @param float      $time
151
-     */
152
-    public function addIncompleteTest(Test $test, \Exception $e, $time)
153
-    {
154
-        $this->printIgnoredTest($test->getName(), $e);
155
-    }
156
-
157
-    /**
158
-     * Risky test.
159
-     *
160
-     * @param Test       $test
161
-     * @param \Exception $e
162
-     * @param float      $time
163
-     */
164
-    public function addRiskyTest(Test $test, \Exception $e, $time)
165
-    {
166
-        $this->addError($test, $e, $time);
167
-    }
168
-
169
-    /**
170
-     * Skipped test.
171
-     *
172
-     * @param Test       $test
173
-     * @param \Exception $e
174
-     * @param float      $time
175
-     */
176
-    public function addSkippedTest(Test $test, \Exception $e, $time)
177
-    {
178
-        $testName = $test->getName();
179
-        if ($this->startedTestName != $testName) {
180
-            $this->startTest($test);
181
-            $this->printIgnoredTest($testName, $e);
182
-            $this->endTest($test, $time);
183
-        } else {
184
-            $this->printIgnoredTest($testName, $e);
185
-        }
186
-    }
187
-
188
-    public function printIgnoredTest($testName, \Exception $e)
189
-    {
190
-        $this->printEvent(
191
-            'testIgnored',
192
-            [
193
-                'name'    => $testName,
194
-                'message' => self::getMessage($e),
195
-                'details' => self::getDetails($e),
196
-            ]
197
-        );
198
-    }
199
-
200
-    /**
201
-     * A testsuite started.
202
-     *
203
-     * @param TestSuite $suite
204
-     */
205
-    public function startTestSuite(TestSuite $suite)
206
-    {
207
-        if (\stripos(\ini_get('disable_functions'), 'getmypid') === false) {
208
-            $this->flowId = \getmypid();
209
-        } else {
210
-            $this->flowId = false;
211
-        }
212
-
213
-        if (!$this->isSummaryTestCountPrinted) {
214
-            $this->isSummaryTestCountPrinted = true;
215
-
216
-            $this->printEvent(
217
-                'testCount',
218
-                ['count' => \count($suite)]
219
-            );
220
-        }
221
-
222
-        $suiteName = $suite->getName();
223
-
224
-        if (empty($suiteName)) {
225
-            return;
226
-        }
227
-
228
-        $parameters = ['name' => $suiteName];
229
-
230
-        if (\class_exists($suiteName, false)) {
231
-            $fileName                   = self::getFileName($suiteName);
232
-            $parameters['locationHint'] = "php_qn://$fileName::\\$suiteName";
233
-        } else {
234
-            $split = \preg_split('/::/', $suiteName);
235
-
236
-            if (\count($split) == 2 && \method_exists($split[0], $split[1])) {
237
-                $fileName                   = self::getFileName($split[0]);
238
-                $parameters['locationHint'] = "php_qn://$fileName::\\$suiteName";
239
-                $parameters['name']         = $split[1];
240
-            }
241
-        }
242
-
243
-        $this->printEvent('testSuiteStarted', $parameters);
244
-    }
245
-
246
-    /**
247
-     * A testsuite ended.
248
-     *
249
-     * @param TestSuite $suite
250
-     */
251
-    public function endTestSuite(TestSuite $suite)
252
-    {
253
-        $suiteName = $suite->getName();
254
-
255
-        if (empty($suiteName)) {
256
-            return;
257
-        }
258
-
259
-        $parameters = ['name' => $suiteName];
260
-
261
-        if (!\class_exists($suiteName, false)) {
262
-            $split = \preg_split('/::/', $suiteName);
263
-
264
-            if (\count($split) == 2 && \method_exists($split[0], $split[1])) {
265
-                $parameters['name'] = $split[1];
266
-            }
267
-        }
268
-
269
-        $this->printEvent('testSuiteFinished', $parameters);
270
-    }
271
-
272
-    /**
273
-     * A test started.
274
-     *
275
-     * @param Test $test
276
-     */
277
-    public function startTest(Test $test)
278
-    {
279
-        $testName              = $test->getName();
280
-        $this->startedTestName = $testName;
281
-        $params                = ['name' => $testName];
282
-
283
-        if ($test instanceof TestCase) {
284
-            $className              = \get_class($test);
285
-            $fileName               = self::getFileName($className);
286
-            $params['locationHint'] = "php_qn://$fileName::\\$className::$testName";
287
-        }
288
-
289
-        $this->printEvent('testStarted', $params);
290
-    }
291
-
292
-    /**
293
-     * A test ended.
294
-     *
295
-     * @param Test  $test
296
-     * @param float $time
297
-     */
298
-    public function endTest(Test $test, $time)
299
-    {
300
-        parent::endTest($test, $time);
301
-
302
-        $this->printEvent(
303
-            'testFinished',
304
-            [
305
-                'name'     => $test->getName(),
306
-                'duration' => (int) (\round($time, 2) * 1000)
307
-            ]
308
-        );
309
-    }
310
-
311
-    /**
312
-     * @param string $eventName
313
-     * @param array  $params
314
-     */
315
-    private function printEvent($eventName, $params = [])
316
-    {
317
-        $this->write("\n##teamcity[$eventName");
318
-
319
-        if ($this->flowId) {
320
-            $params['flowId'] = $this->flowId;
321
-        }
322
-
323
-        foreach ($params as $key => $value) {
324
-            $escapedValue = self::escapeValue($value);
325
-            $this->write(" $key='$escapedValue'");
326
-        }
327
-
328
-        $this->write("]\n");
329
-    }
330
-
331
-    /**
332
-     * @param \Exception $e
333
-     *
334
-     * @return string
335
-     */
336
-    private static function getMessage(\Exception $e)
337
-    {
338
-        $message = '';
339
-
340
-        if (!$e instanceof Exception) {
341
-            if (\strlen(\get_class($e)) != 0) {
342
-                $message .= \get_class($e);
343
-            }
344
-
345
-            if (\strlen($message) != 0 && \strlen($e->getMessage()) != 0) {
346
-                $message .= ' : ';
347
-            }
348
-        }
349
-
350
-        return $message . $e->getMessage();
351
-    }
352
-
353
-    /**
354
-     * @param \Exception $e
355
-     *
356
-     * @return string
357
-     */
358
-    private static function getDetails(\Exception $e)
359
-    {
360
-        $stackTrace = Filter::getFilteredStacktrace($e);
361
-        $previous   = $e instanceof ExceptionWrapper ?
362
-            $e->getPreviousWrapped() : $e->getPrevious();
363
-
364
-        while ($previous) {
365
-            $stackTrace .= "\nCaused by\n" .
366
-                TestFailure::exceptionToString($previous) . "\n" .
367
-                Filter::getFilteredStacktrace($previous);
368
-
369
-            $previous = $previous instanceof ExceptionWrapper ?
370
-                $previous->getPreviousWrapped() : $previous->getPrevious();
371
-        }
372
-
373
-        return ' ' . \str_replace("\n", "\n ", $stackTrace);
374
-    }
375
-
376
-    /**
377
-     * @param mixed $value
378
-     *
379
-     * @return string
380
-     */
381
-    private static function getPrimitiveValueAsString($value)
382
-    {
383
-        if (null === $value) {
384
-            return 'null';
385
-        }
386
-
387
-        if (\is_bool($value)) {
388
-            return $value == true ? 'true' : 'false';
389
-        }
390
-
391
-        if (\is_scalar($value)) {
392
-            return \print_r($value, true);
393
-        }
394
-    }
395
-
396
-    /**
397
-     * @param  $text
398
-     *
399
-     * @return string
400
-     */
401
-    private static function escapeValue($text)
402
-    {
403
-        $text = \str_replace('|', '||', $text);
404
-        $text = \str_replace("'", "|'", $text);
405
-        $text = \str_replace("\n", '|n', $text);
406
-        $text = \str_replace("\r", '|r', $text);
407
-        $text = \str_replace(']', '|]', $text);
408
-        $text = \str_replace('[', '|[', $text);
409
-
410
-        return $text;
411
-    }
412
-
413
-    /**
414
-     * @param string $className
415
-     *
416
-     * @return string
417
-     */
418
-    private static function getFileName($className)
419
-    {
420
-        $reflectionClass = new ReflectionClass($className);
421
-
422
-        return $reflectionClass->getFileName();
423
-    }
34
+	/**
35
+	 * @var bool
36
+	 */
37
+	private $isSummaryTestCountPrinted = false;
38
+
39
+	/**
40
+	 * @var string
41
+	 */
42
+	private $startedTestName;
43
+
44
+	/**
45
+	 * @var int|false
46
+	 */
47
+	private $flowId;
48
+
49
+	/**
50
+	 * @param string $progress
51
+	 */
52
+	protected function writeProgress($progress)
53
+	{
54
+	}
55
+
56
+	/**
57
+	 * @param TestResult $result
58
+	 */
59
+	public function printResult(TestResult $result)
60
+	{
61
+		$this->printHeader();
62
+		$this->printFooter($result);
63
+	}
64
+
65
+	/**
66
+	 * An error occurred.
67
+	 *
68
+	 * @param Test       $test
69
+	 * @param \Exception $e
70
+	 * @param float      $time
71
+	 */
72
+	public function addError(Test $test, \Exception $e, $time)
73
+	{
74
+		$this->printEvent(
75
+			'testFailed',
76
+			[
77
+				'name'    => $test->getName(),
78
+				'message' => self::getMessage($e),
79
+				'details' => self::getDetails($e),
80
+			]
81
+		);
82
+	}
83
+
84
+	/**
85
+	 * A warning occurred.
86
+	 *
87
+	 * @param Test    $test
88
+	 * @param Warning $e
89
+	 * @param float   $time
90
+	 */
91
+	public function addWarning(Test $test, Warning $e, $time)
92
+	{
93
+		$this->printEvent(
94
+			'testFailed',
95
+			[
96
+				'name'    => $test->getName(),
97
+				'message' => self::getMessage($e),
98
+				'details' => self::getDetails($e)
99
+			]
100
+		);
101
+	}
102
+
103
+	/**
104
+	 * A failure occurred.
105
+	 *
106
+	 * @param Test                 $test
107
+	 * @param AssertionFailedError $e
108
+	 * @param float                $time
109
+	 */
110
+	public function addFailure(Test $test, AssertionFailedError $e, $time)
111
+	{
112
+		$parameters = [
113
+			'name'    => $test->getName(),
114
+			'message' => self::getMessage($e),
115
+			'details' => self::getDetails($e),
116
+		];
117
+
118
+		if ($e instanceof ExpectationFailedException) {
119
+			$comparisonFailure = $e->getComparisonFailure();
120
+
121
+			if ($comparisonFailure instanceof ComparisonFailure) {
122
+				$expectedString = $comparisonFailure->getExpectedAsString();
123
+
124
+				if (null === $expectedString || empty($expectedString)) {
125
+					$expectedString = self::getPrimitiveValueAsString($comparisonFailure->getExpected());
126
+				}
127
+
128
+				$actualString = $comparisonFailure->getActualAsString();
129
+
130
+				if (null === $actualString || empty($actualString)) {
131
+					$actualString = self::getPrimitiveValueAsString($comparisonFailure->getActual());
132
+				}
133
+
134
+				if (null !== $actualString && null !== $expectedString) {
135
+					$parameters['type']     = 'comparisonFailure';
136
+					$parameters['actual']   = $actualString;
137
+					$parameters['expected'] = $expectedString;
138
+				}
139
+			}
140
+		}
141
+
142
+		$this->printEvent('testFailed', $parameters);
143
+	}
144
+
145
+	/**
146
+	 * Incomplete test.
147
+	 *
148
+	 * @param Test       $test
149
+	 * @param \Exception $e
150
+	 * @param float      $time
151
+	 */
152
+	public function addIncompleteTest(Test $test, \Exception $e, $time)
153
+	{
154
+		$this->printIgnoredTest($test->getName(), $e);
155
+	}
156
+
157
+	/**
158
+	 * Risky test.
159
+	 *
160
+	 * @param Test       $test
161
+	 * @param \Exception $e
162
+	 * @param float      $time
163
+	 */
164
+	public function addRiskyTest(Test $test, \Exception $e, $time)
165
+	{
166
+		$this->addError($test, $e, $time);
167
+	}
168
+
169
+	/**
170
+	 * Skipped test.
171
+	 *
172
+	 * @param Test       $test
173
+	 * @param \Exception $e
174
+	 * @param float      $time
175
+	 */
176
+	public function addSkippedTest(Test $test, \Exception $e, $time)
177
+	{
178
+		$testName = $test->getName();
179
+		if ($this->startedTestName != $testName) {
180
+			$this->startTest($test);
181
+			$this->printIgnoredTest($testName, $e);
182
+			$this->endTest($test, $time);
183
+		} else {
184
+			$this->printIgnoredTest($testName, $e);
185
+		}
186
+	}
187
+
188
+	public function printIgnoredTest($testName, \Exception $e)
189
+	{
190
+		$this->printEvent(
191
+			'testIgnored',
192
+			[
193
+				'name'    => $testName,
194
+				'message' => self::getMessage($e),
195
+				'details' => self::getDetails($e),
196
+			]
197
+		);
198
+	}
199
+
200
+	/**
201
+	 * A testsuite started.
202
+	 *
203
+	 * @param TestSuite $suite
204
+	 */
205
+	public function startTestSuite(TestSuite $suite)
206
+	{
207
+		if (\stripos(\ini_get('disable_functions'), 'getmypid') === false) {
208
+			$this->flowId = \getmypid();
209
+		} else {
210
+			$this->flowId = false;
211
+		}
212
+
213
+		if (!$this->isSummaryTestCountPrinted) {
214
+			$this->isSummaryTestCountPrinted = true;
215
+
216
+			$this->printEvent(
217
+				'testCount',
218
+				['count' => \count($suite)]
219
+			);
220
+		}
221
+
222
+		$suiteName = $suite->getName();
223
+
224
+		if (empty($suiteName)) {
225
+			return;
226
+		}
227
+
228
+		$parameters = ['name' => $suiteName];
229
+
230
+		if (\class_exists($suiteName, false)) {
231
+			$fileName                   = self::getFileName($suiteName);
232
+			$parameters['locationHint'] = "php_qn://$fileName::\\$suiteName";
233
+		} else {
234
+			$split = \preg_split('/::/', $suiteName);
235
+
236
+			if (\count($split) == 2 && \method_exists($split[0], $split[1])) {
237
+				$fileName                   = self::getFileName($split[0]);
238
+				$parameters['locationHint'] = "php_qn://$fileName::\\$suiteName";
239
+				$parameters['name']         = $split[1];
240
+			}
241
+		}
242
+
243
+		$this->printEvent('testSuiteStarted', $parameters);
244
+	}
245
+
246
+	/**
247
+	 * A testsuite ended.
248
+	 *
249
+	 * @param TestSuite $suite
250
+	 */
251
+	public function endTestSuite(TestSuite $suite)
252
+	{
253
+		$suiteName = $suite->getName();
254
+
255
+		if (empty($suiteName)) {
256
+			return;
257
+		}
258
+
259
+		$parameters = ['name' => $suiteName];
260
+
261
+		if (!\class_exists($suiteName, false)) {
262
+			$split = \preg_split('/::/', $suiteName);
263
+
264
+			if (\count($split) == 2 && \method_exists($split[0], $split[1])) {
265
+				$parameters['name'] = $split[1];
266
+			}
267
+		}
268
+
269
+		$this->printEvent('testSuiteFinished', $parameters);
270
+	}
271
+
272
+	/**
273
+	 * A test started.
274
+	 *
275
+	 * @param Test $test
276
+	 */
277
+	public function startTest(Test $test)
278
+	{
279
+		$testName              = $test->getName();
280
+		$this->startedTestName = $testName;
281
+		$params                = ['name' => $testName];
282
+
283
+		if ($test instanceof TestCase) {
284
+			$className              = \get_class($test);
285
+			$fileName               = self::getFileName($className);
286
+			$params['locationHint'] = "php_qn://$fileName::\\$className::$testName";
287
+		}
288
+
289
+		$this->printEvent('testStarted', $params);
290
+	}
291
+
292
+	/**
293
+	 * A test ended.
294
+	 *
295
+	 * @param Test  $test
296
+	 * @param float $time
297
+	 */
298
+	public function endTest(Test $test, $time)
299
+	{
300
+		parent::endTest($test, $time);
301
+
302
+		$this->printEvent(
303
+			'testFinished',
304
+			[
305
+				'name'     => $test->getName(),
306
+				'duration' => (int) (\round($time, 2) * 1000)
307
+			]
308
+		);
309
+	}
310
+
311
+	/**
312
+	 * @param string $eventName
313
+	 * @param array  $params
314
+	 */
315
+	private function printEvent($eventName, $params = [])
316
+	{
317
+		$this->write("\n##teamcity[$eventName");
318
+
319
+		if ($this->flowId) {
320
+			$params['flowId'] = $this->flowId;
321
+		}
322
+
323
+		foreach ($params as $key => $value) {
324
+			$escapedValue = self::escapeValue($value);
325
+			$this->write(" $key='$escapedValue'");
326
+		}
327
+
328
+		$this->write("]\n");
329
+	}
330
+
331
+	/**
332
+	 * @param \Exception $e
333
+	 *
334
+	 * @return string
335
+	 */
336
+	private static function getMessage(\Exception $e)
337
+	{
338
+		$message = '';
339
+
340
+		if (!$e instanceof Exception) {
341
+			if (\strlen(\get_class($e)) != 0) {
342
+				$message .= \get_class($e);
343
+			}
344
+
345
+			if (\strlen($message) != 0 && \strlen($e->getMessage()) != 0) {
346
+				$message .= ' : ';
347
+			}
348
+		}
349
+
350
+		return $message . $e->getMessage();
351
+	}
352
+
353
+	/**
354
+	 * @param \Exception $e
355
+	 *
356
+	 * @return string
357
+	 */
358
+	private static function getDetails(\Exception $e)
359
+	{
360
+		$stackTrace = Filter::getFilteredStacktrace($e);
361
+		$previous   = $e instanceof ExceptionWrapper ?
362
+			$e->getPreviousWrapped() : $e->getPrevious();
363
+
364
+		while ($previous) {
365
+			$stackTrace .= "\nCaused by\n" .
366
+				TestFailure::exceptionToString($previous) . "\n" .
367
+				Filter::getFilteredStacktrace($previous);
368
+
369
+			$previous = $previous instanceof ExceptionWrapper ?
370
+				$previous->getPreviousWrapped() : $previous->getPrevious();
371
+		}
372
+
373
+		return ' ' . \str_replace("\n", "\n ", $stackTrace);
374
+	}
375
+
376
+	/**
377
+	 * @param mixed $value
378
+	 *
379
+	 * @return string
380
+	 */
381
+	private static function getPrimitiveValueAsString($value)
382
+	{
383
+		if (null === $value) {
384
+			return 'null';
385
+		}
386
+
387
+		if (\is_bool($value)) {
388
+			return $value == true ? 'true' : 'false';
389
+		}
390
+
391
+		if (\is_scalar($value)) {
392
+			return \print_r($value, true);
393
+		}
394
+	}
395
+
396
+	/**
397
+	 * @param  $text
398
+	 *
399
+	 * @return string
400
+	 */
401
+	private static function escapeValue($text)
402
+	{
403
+		$text = \str_replace('|', '||', $text);
404
+		$text = \str_replace("'", "|'", $text);
405
+		$text = \str_replace("\n", '|n', $text);
406
+		$text = \str_replace("\r", '|r', $text);
407
+		$text = \str_replace(']', '|]', $text);
408
+		$text = \str_replace('[', '|[', $text);
409
+
410
+		return $text;
411
+	}
412
+
413
+	/**
414
+	 * @param string $className
415
+	 *
416
+	 * @return string
417
+	 */
418
+	private static function getFileName($className)
419
+	{
420
+		$reflectionClass = new ReflectionClass($className);
421
+
422
+		return $reflectionClass->getFileName();
423
+	}
424 424
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             }
348 348
         }
349 349
 
350
-        return $message . $e->getMessage();
350
+        return $message.$e->getMessage();
351 351
     }
352 352
 
353 353
     /**
@@ -362,15 +362,15 @@  discard block
 block discarded – undo
362 362
             $e->getPreviousWrapped() : $e->getPrevious();
363 363
 
364 364
         while ($previous) {
365
-            $stackTrace .= "\nCaused by\n" .
366
-                TestFailure::exceptionToString($previous) . "\n" .
365
+            $stackTrace .= "\nCaused by\n".
366
+                TestFailure::exceptionToString($previous)."\n".
367 367
                 Filter::getFilteredStacktrace($previous);
368 368
 
369 369
             $previous = $previous instanceof ExceptionWrapper ?
370 370
                 $previous->getPreviousWrapped() : $previous->getPrevious();
371 371
         }
372 372
 
373
-        return ' ' . \str_replace("\n", "\n ", $stackTrace);
373
+        return ' '.\str_replace("\n", "\n ", $stackTrace);
374 374
     }
375 375
 
376 376
     /**
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Util/TestDox/TextResultPrinter.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -14,40 +14,40 @@
 block discarded – undo
14 14
  */
15 15
 class TextResultPrinter extends ResultPrinter
16 16
 {
17
-    /**
18
-     * Handler for 'start class' event.
19
-     *
20
-     * @param string $name
21
-     */
22
-    protected function startClass($name)
23
-    {
24
-        $this->write($this->currentTestClassPrettified . "\n");
25
-    }
17
+	/**
18
+	 * Handler for 'start class' event.
19
+	 *
20
+	 * @param string $name
21
+	 */
22
+	protected function startClass($name)
23
+	{
24
+		$this->write($this->currentTestClassPrettified . "\n");
25
+	}
26 26
 
27
-    /**
28
-     * Handler for 'on test' event.
29
-     *
30
-     * @param string $name
31
-     * @param bool   $success
32
-     */
33
-    protected function onTest($name, $success = true)
34
-    {
35
-        if ($success) {
36
-            $this->write(' [x] ');
37
-        } else {
38
-            $this->write(' [ ] ');
39
-        }
27
+	/**
28
+	 * Handler for 'on test' event.
29
+	 *
30
+	 * @param string $name
31
+	 * @param bool   $success
32
+	 */
33
+	protected function onTest($name, $success = true)
34
+	{
35
+		if ($success) {
36
+			$this->write(' [x] ');
37
+		} else {
38
+			$this->write(' [ ] ');
39
+		}
40 40
 
41
-        $this->write($name . "\n");
42
-    }
41
+		$this->write($name . "\n");
42
+	}
43 43
 
44
-    /**
45
-     * Handler for 'end class' event.
46
-     *
47
-     * @param string $name
48
-     */
49
-    protected function endClass($name)
50
-    {
51
-        $this->write("\n");
52
-    }
44
+	/**
45
+	 * Handler for 'end class' event.
46
+	 *
47
+	 * @param string $name
48
+	 */
49
+	protected function endClass($name)
50
+	{
51
+		$this->write("\n");
52
+	}
53 53
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected function startClass($name)
23 23
     {
24
-        $this->write($this->currentTestClassPrettified . "\n");
24
+        $this->write($this->currentTestClassPrettified."\n");
25 25
     }
26 26
 
27 27
     /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $this->write(' [ ] ');
39 39
         }
40 40
 
41
-        $this->write($name . "\n");
41
+        $this->write($name."\n");
42 42
     }
43 43
 
44 44
     /**
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php 2 patches
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -23,216 +23,216 @@
 block discarded – undo
23 23
 
24 24
 class XmlResultPrinter extends Printer implements TestListener
25 25
 {
26
-    /**
27
-     * @var DOMDocument
28
-     */
29
-    private $document;
30
-
31
-    /**
32
-     * @var DOMElement
33
-     */
34
-    private $root;
35
-
36
-    /**
37
-     * @var NamePrettifier
38
-     */
39
-    private $prettifier;
40
-
41
-    /**
42
-     * @var \Exception|null
43
-     */
44
-    private $exception;
45
-
46
-    /**
47
-     * @param string|resource $out
48
-     */
49
-    public function __construct($out = null)
50
-    {
51
-        $this->document               = new DOMDocument('1.0', 'UTF-8');
52
-        $this->document->formatOutput = true;
53
-
54
-        $this->root = $this->document->createElement('tests');
55
-        $this->document->appendChild($this->root);
56
-
57
-        $this->prettifier = new NamePrettifier;
58
-
59
-        parent::__construct($out);
60
-    }
61
-
62
-    /**
63
-     * Flush buffer and close output.
64
-     */
65
-    public function flush()
66
-    {
67
-        $this->write($this->document->saveXML());
68
-
69
-        parent::flush();
70
-    }
71
-
72
-    /**
73
-     * An error occurred.
74
-     *
75
-     * @param Test       $test
76
-     * @param \Exception $e
77
-     * @param float      $time
78
-     */
79
-    public function addError(Test $test, \Exception $e, $time)
80
-    {
81
-        $this->exception = $e;
82
-    }
83
-
84
-    /**
85
-     * A warning occurred.
86
-     *
87
-     * @param Test    $test
88
-     * @param Warning $e
89
-     * @param float   $time
90
-     */
91
-    public function addWarning(Test $test, Warning $e, $time)
92
-    {
93
-    }
94
-
95
-    /**
96
-     * A failure occurred.
97
-     *
98
-     * @param Test                 $test
99
-     * @param AssertionFailedError $e
100
-     * @param float                $time
101
-     */
102
-    public function addFailure(Test $test, AssertionFailedError $e, $time)
103
-    {
104
-        $this->exception = $e;
105
-    }
106
-
107
-    /**
108
-     * Incomplete test.
109
-     *
110
-     * @param Test       $test
111
-     * @param \Exception $e
112
-     * @param float      $time
113
-     */
114
-    public function addIncompleteTest(Test $test, \Exception $e, $time)
115
-    {
116
-    }
117
-
118
-    /**
119
-     * Risky test.
120
-     *
121
-     * @param Test       $test
122
-     * @param \Exception $e
123
-     * @param float      $time
124
-     */
125
-    public function addRiskyTest(Test $test, \Exception $e, $time)
126
-    {
127
-    }
128
-
129
-    /**
130
-     * Skipped test.
131
-     *
132
-     * @param Test       $test
133
-     * @param \Exception $e
134
-     * @param float      $time
135
-     */
136
-    public function addSkippedTest(Test $test, \Exception $e, $time)
137
-    {
138
-    }
139
-
140
-    /**
141
-     * A test suite started.
142
-     *
143
-     * @param TestSuite $suite
144
-     */
145
-    public function startTestSuite(TestSuite $suite)
146
-    {
147
-    }
148
-
149
-    /**
150
-     * A test suite ended.
151
-     *
152
-     * @param TestSuite $suite
153
-     */
154
-    public function endTestSuite(TestSuite $suite)
155
-    {
156
-    }
157
-
158
-    /**
159
-     * A test started.
160
-     *
161
-     * @param Test $test
162
-     */
163
-    public function startTest(Test $test)
164
-    {
165
-        $this->exception = null;
166
-    }
167
-
168
-    /**
169
-     * A test ended.
170
-     *
171
-     * @param Test  $test
172
-     * @param float $time
173
-     */
174
-    public function endTest(Test $test, $time)
175
-    {
176
-        if (!$test instanceof TestCase) {
177
-            return;
178
-        }
179
-
180
-        /* @var TestCase $test */
181
-
182
-        $groups = \array_filter(
183
-            $test->getGroups(),
184
-            function ($group) {
185
-                if ($group == 'small' || $group == 'medium' || $group == 'large') {
186
-                    return false;
187
-                }
188
-
189
-                return true;
190
-            }
191
-        );
192
-
193
-        $node = $this->document->createElement('test');
194
-
195
-        $node->setAttribute('className', \get_class($test));
196
-        $node->setAttribute('methodName', $test->getName());
197
-        $node->setAttribute('prettifiedClassName', $this->prettifier->prettifyTestClass(\get_class($test)));
198
-        $node->setAttribute('prettifiedMethodName', $this->prettifier->prettifyTestMethod($test->getName()));
199
-        $node->setAttribute('status', $test->getStatus());
200
-        $node->setAttribute('time', $time);
201
-        $node->setAttribute('size', $test->getSize());
202
-        $node->setAttribute('groups', \implode(',', $groups));
203
-
204
-        $inlineAnnotations = \PHPUnit\Util\Test::getInlineAnnotations(\get_class($test), $test->getName());
205
-
206
-        if (isset($inlineAnnotations['given']) && isset($inlineAnnotations['when']) && isset($inlineAnnotations['then'])) {
207
-            $node->setAttribute('given', $inlineAnnotations['given']['value']);
208
-            $node->setAttribute('givenStartLine', $inlineAnnotations['given']['line']);
209
-            $node->setAttribute('when', $inlineAnnotations['when']['value']);
210
-            $node->setAttribute('whenStartLine', $inlineAnnotations['when']['line']);
211
-            $node->setAttribute('then', $inlineAnnotations['then']['value']);
212
-            $node->setAttribute('thenStartLine', $inlineAnnotations['then']['line']);
213
-        }
214
-
215
-        if ($this->exception !== null) {
216
-            if ($this->exception instanceof Exception) {
217
-                $steps = $this->exception->getSerializableTrace();
218
-            } else {
219
-                $steps = $this->exception->getTrace();
220
-            }
221
-
222
-            $class = new ReflectionClass($test);
223
-            $file  = $class->getFileName();
224
-
225
-            foreach ($steps as $step) {
226
-                if (isset($step['file']) && $step['file'] == $file) {
227
-                    $node->setAttribute('exceptionLine', $step['line']);
228
-
229
-                    break;
230
-                }
231
-            }
232
-
233
-            $node->setAttribute('exceptionMessage', $this->exception->getMessage());
234
-        }
235
-
236
-        $this->root->appendChild($node);
237
-    }
26
+	/**
27
+	 * @var DOMDocument
28
+	 */
29
+	private $document;
30
+
31
+	/**
32
+	 * @var DOMElement
33
+	 */
34
+	private $root;
35
+
36
+	/**
37
+	 * @var NamePrettifier
38
+	 */
39
+	private $prettifier;
40
+
41
+	/**
42
+	 * @var \Exception|null
43
+	 */
44
+	private $exception;
45
+
46
+	/**
47
+	 * @param string|resource $out
48
+	 */
49
+	public function __construct($out = null)
50
+	{
51
+		$this->document               = new DOMDocument('1.0', 'UTF-8');
52
+		$this->document->formatOutput = true;
53
+
54
+		$this->root = $this->document->createElement('tests');
55
+		$this->document->appendChild($this->root);
56
+
57
+		$this->prettifier = new NamePrettifier;
58
+
59
+		parent::__construct($out);
60
+	}
61
+
62
+	/**
63
+	 * Flush buffer and close output.
64
+	 */
65
+	public function flush()
66
+	{
67
+		$this->write($this->document->saveXML());
68
+
69
+		parent::flush();
70
+	}
71
+
72
+	/**
73
+	 * An error occurred.
74
+	 *
75
+	 * @param Test       $test
76
+	 * @param \Exception $e
77
+	 * @param float      $time
78
+	 */
79
+	public function addError(Test $test, \Exception $e, $time)
80
+	{
81
+		$this->exception = $e;
82
+	}
83
+
84
+	/**
85
+	 * A warning occurred.
86
+	 *
87
+	 * @param Test    $test
88
+	 * @param Warning $e
89
+	 * @param float   $time
90
+	 */
91
+	public function addWarning(Test $test, Warning $e, $time)
92
+	{
93
+	}
94
+
95
+	/**
96
+	 * A failure occurred.
97
+	 *
98
+	 * @param Test                 $test
99
+	 * @param AssertionFailedError $e
100
+	 * @param float                $time
101
+	 */
102
+	public function addFailure(Test $test, AssertionFailedError $e, $time)
103
+	{
104
+		$this->exception = $e;
105
+	}
106
+
107
+	/**
108
+	 * Incomplete test.
109
+	 *
110
+	 * @param Test       $test
111
+	 * @param \Exception $e
112
+	 * @param float      $time
113
+	 */
114
+	public function addIncompleteTest(Test $test, \Exception $e, $time)
115
+	{
116
+	}
117
+
118
+	/**
119
+	 * Risky test.
120
+	 *
121
+	 * @param Test       $test
122
+	 * @param \Exception $e
123
+	 * @param float      $time
124
+	 */
125
+	public function addRiskyTest(Test $test, \Exception $e, $time)
126
+	{
127
+	}
128
+
129
+	/**
130
+	 * Skipped test.
131
+	 *
132
+	 * @param Test       $test
133
+	 * @param \Exception $e
134
+	 * @param float      $time
135
+	 */
136
+	public function addSkippedTest(Test $test, \Exception $e, $time)
137
+	{
138
+	}
139
+
140
+	/**
141
+	 * A test suite started.
142
+	 *
143
+	 * @param TestSuite $suite
144
+	 */
145
+	public function startTestSuite(TestSuite $suite)
146
+	{
147
+	}
148
+
149
+	/**
150
+	 * A test suite ended.
151
+	 *
152
+	 * @param TestSuite $suite
153
+	 */
154
+	public function endTestSuite(TestSuite $suite)
155
+	{
156
+	}
157
+
158
+	/**
159
+	 * A test started.
160
+	 *
161
+	 * @param Test $test
162
+	 */
163
+	public function startTest(Test $test)
164
+	{
165
+		$this->exception = null;
166
+	}
167
+
168
+	/**
169
+	 * A test ended.
170
+	 *
171
+	 * @param Test  $test
172
+	 * @param float $time
173
+	 */
174
+	public function endTest(Test $test, $time)
175
+	{
176
+		if (!$test instanceof TestCase) {
177
+			return;
178
+		}
179
+
180
+		/* @var TestCase $test */
181
+
182
+		$groups = \array_filter(
183
+			$test->getGroups(),
184
+			function ($group) {
185
+				if ($group == 'small' || $group == 'medium' || $group == 'large') {
186
+					return false;
187
+				}
188
+
189
+				return true;
190
+			}
191
+		);
192
+
193
+		$node = $this->document->createElement('test');
194
+
195
+		$node->setAttribute('className', \get_class($test));
196
+		$node->setAttribute('methodName', $test->getName());
197
+		$node->setAttribute('prettifiedClassName', $this->prettifier->prettifyTestClass(\get_class($test)));
198
+		$node->setAttribute('prettifiedMethodName', $this->prettifier->prettifyTestMethod($test->getName()));
199
+		$node->setAttribute('status', $test->getStatus());
200
+		$node->setAttribute('time', $time);
201
+		$node->setAttribute('size', $test->getSize());
202
+		$node->setAttribute('groups', \implode(',', $groups));
203
+
204
+		$inlineAnnotations = \PHPUnit\Util\Test::getInlineAnnotations(\get_class($test), $test->getName());
205
+
206
+		if (isset($inlineAnnotations['given']) && isset($inlineAnnotations['when']) && isset($inlineAnnotations['then'])) {
207
+			$node->setAttribute('given', $inlineAnnotations['given']['value']);
208
+			$node->setAttribute('givenStartLine', $inlineAnnotations['given']['line']);
209
+			$node->setAttribute('when', $inlineAnnotations['when']['value']);
210
+			$node->setAttribute('whenStartLine', $inlineAnnotations['when']['line']);
211
+			$node->setAttribute('then', $inlineAnnotations['then']['value']);
212
+			$node->setAttribute('thenStartLine', $inlineAnnotations['then']['line']);
213
+		}
214
+
215
+		if ($this->exception !== null) {
216
+			if ($this->exception instanceof Exception) {
217
+				$steps = $this->exception->getSerializableTrace();
218
+			} else {
219
+				$steps = $this->exception->getTrace();
220
+			}
221
+
222
+			$class = new ReflectionClass($test);
223
+			$file  = $class->getFileName();
224
+
225
+			foreach ($steps as $step) {
226
+				if (isset($step['file']) && $step['file'] == $file) {
227
+					$node->setAttribute('exceptionLine', $step['line']);
228
+
229
+					break;
230
+				}
231
+			}
232
+
233
+			$node->setAttribute('exceptionMessage', $this->exception->getMessage());
234
+		}
235
+
236
+		$this->root->appendChild($node);
237
+	}
238 238
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@
 block discarded – undo
181 181
 
182 182
         $groups = \array_filter(
183 183
             $test->getGroups(),
184
-            function ($group) {
184
+            function($group) {
185 185
                 if ($group == 'small' || $group == 'medium' || $group == 'large') {
186 186
                     return false;
187 187
                 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php 2 patches
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -15,128 +15,128 @@
 block discarded – undo
15 15
  */
16 16
 class NamePrettifier
17 17
 {
18
-    /**
19
-     * @var string
20
-     */
21
-    protected $prefix = 'Test';
22
-
23
-    /**
24
-     * @var string
25
-     */
26
-    protected $suffix = 'Test';
27
-
28
-    /**
29
-     * @var array
30
-     */
31
-    protected $strings = [];
32
-
33
-    /**
34
-     * Prettifies the name of a test class.
35
-     *
36
-     * @param string $name
37
-     *
38
-     * @return string
39
-     */
40
-    public function prettifyTestClass($name)
41
-    {
42
-        $title = $name;
43
-
44
-        if ($this->suffix !== null &&
45
-            $this->suffix == \substr($name, -1 * \strlen($this->suffix))) {
46
-            $title = \substr($title, 0, \strripos($title, $this->suffix));
47
-        }
48
-
49
-        if ($this->prefix !== null &&
50
-            $this->prefix == \substr($name, 0, \strlen($this->prefix))) {
51
-            $title = \substr($title, \strlen($this->prefix));
52
-        }
53
-
54
-        if (\substr($title, 0, 1) == '\\') {
55
-            $title = \substr($title, 1);
56
-        }
57
-
58
-        return $title;
59
-    }
60
-
61
-    /**
62
-     * Prettifies the name of a test method.
63
-     *
64
-     * @param string $name
65
-     *
66
-     * @return string
67
-     */
68
-    public function prettifyTestMethod($name)
69
-    {
70
-        $buffer = '';
71
-
72
-        if (!\is_string($name) || \strlen($name) == 0) {
73
-            return $buffer;
74
-        }
75
-
76
-        $string = \preg_replace('#\d+$#', '', $name, -1, $count);
77
-
78
-        if (\in_array($string, $this->strings)) {
79
-            $name = $string;
80
-        } elseif ($count == 0) {
81
-            $this->strings[] = $string;
82
-        }
83
-
84
-        if (\substr($name, 0, 4) == 'test') {
85
-            $name = \substr($name, 4);
86
-        }
87
-
88
-        if (\strlen($name) == 0) {
89
-            return $buffer;
90
-        }
91
-
92
-        $name[0] = \strtoupper($name[0]);
93
-
94
-        if (\strpos($name, '_') !== false) {
95
-            return \trim(\str_replace('_', ' ', $name));
96
-        }
97
-
98
-        $max        = \strlen($name);
99
-        $wasNumeric = false;
100
-
101
-        for ($i = 0; $i < $max; $i++) {
102
-            if ($i > 0 && \ord($name[$i]) >= 65 && \ord($name[$i]) <= 90) {
103
-                $buffer .= ' ' . \strtolower($name[$i]);
104
-            } else {
105
-                $isNumeric = \is_numeric($name[$i]);
106
-
107
-                if (!$wasNumeric && $isNumeric) {
108
-                    $buffer .= ' ';
109
-                    $wasNumeric = true;
110
-                }
111
-
112
-                if ($wasNumeric && !$isNumeric) {
113
-                    $wasNumeric = false;
114
-                }
115
-
116
-                $buffer .= $name[$i];
117
-            }
118
-        }
119
-
120
-        return $buffer;
121
-    }
122
-
123
-    /**
124
-     * Sets the prefix of test names.
125
-     *
126
-     * @param string $prefix
127
-     */
128
-    public function setPrefix($prefix)
129
-    {
130
-        $this->prefix = $prefix;
131
-    }
132
-
133
-    /**
134
-     * Sets the suffix of test names.
135
-     *
136
-     * @param string $suffix
137
-     */
138
-    public function setSuffix($suffix)
139
-    {
140
-        $this->suffix = $suffix;
141
-    }
18
+	/**
19
+	 * @var string
20
+	 */
21
+	protected $prefix = 'Test';
22
+
23
+	/**
24
+	 * @var string
25
+	 */
26
+	protected $suffix = 'Test';
27
+
28
+	/**
29
+	 * @var array
30
+	 */
31
+	protected $strings = [];
32
+
33
+	/**
34
+	 * Prettifies the name of a test class.
35
+	 *
36
+	 * @param string $name
37
+	 *
38
+	 * @return string
39
+	 */
40
+	public function prettifyTestClass($name)
41
+	{
42
+		$title = $name;
43
+
44
+		if ($this->suffix !== null &&
45
+			$this->suffix == \substr($name, -1 * \strlen($this->suffix))) {
46
+			$title = \substr($title, 0, \strripos($title, $this->suffix));
47
+		}
48
+
49
+		if ($this->prefix !== null &&
50
+			$this->prefix == \substr($name, 0, \strlen($this->prefix))) {
51
+			$title = \substr($title, \strlen($this->prefix));
52
+		}
53
+
54
+		if (\substr($title, 0, 1) == '\\') {
55
+			$title = \substr($title, 1);
56
+		}
57
+
58
+		return $title;
59
+	}
60
+
61
+	/**
62
+	 * Prettifies the name of a test method.
63
+	 *
64
+	 * @param string $name
65
+	 *
66
+	 * @return string
67
+	 */
68
+	public function prettifyTestMethod($name)
69
+	{
70
+		$buffer = '';
71
+
72
+		if (!\is_string($name) || \strlen($name) == 0) {
73
+			return $buffer;
74
+		}
75
+
76
+		$string = \preg_replace('#\d+$#', '', $name, -1, $count);
77
+
78
+		if (\in_array($string, $this->strings)) {
79
+			$name = $string;
80
+		} elseif ($count == 0) {
81
+			$this->strings[] = $string;
82
+		}
83
+
84
+		if (\substr($name, 0, 4) == 'test') {
85
+			$name = \substr($name, 4);
86
+		}
87
+
88
+		if (\strlen($name) == 0) {
89
+			return $buffer;
90
+		}
91
+
92
+		$name[0] = \strtoupper($name[0]);
93
+
94
+		if (\strpos($name, '_') !== false) {
95
+			return \trim(\str_replace('_', ' ', $name));
96
+		}
97
+
98
+		$max        = \strlen($name);
99
+		$wasNumeric = false;
100
+
101
+		for ($i = 0; $i < $max; $i++) {
102
+			if ($i > 0 && \ord($name[$i]) >= 65 && \ord($name[$i]) <= 90) {
103
+				$buffer .= ' ' . \strtolower($name[$i]);
104
+			} else {
105
+				$isNumeric = \is_numeric($name[$i]);
106
+
107
+				if (!$wasNumeric && $isNumeric) {
108
+					$buffer .= ' ';
109
+					$wasNumeric = true;
110
+				}
111
+
112
+				if ($wasNumeric && !$isNumeric) {
113
+					$wasNumeric = false;
114
+				}
115
+
116
+				$buffer .= $name[$i];
117
+			}
118
+		}
119
+
120
+		return $buffer;
121
+	}
122
+
123
+	/**
124
+	 * Sets the prefix of test names.
125
+	 *
126
+	 * @param string $prefix
127
+	 */
128
+	public function setPrefix($prefix)
129
+	{
130
+		$this->prefix = $prefix;
131
+	}
132
+
133
+	/**
134
+	 * Sets the suffix of test names.
135
+	 *
136
+	 * @param string $suffix
137
+	 */
138
+	public function setSuffix($suffix)
139
+	{
140
+		$this->suffix = $suffix;
141
+	}
142 142
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
 
101 101
         for ($i = 0; $i < $max; $i++) {
102 102
             if ($i > 0 && \ord($name[$i]) >= 65 && \ord($name[$i]) <= 90) {
103
-                $buffer .= ' ' . \strtolower($name[$i]);
103
+                $buffer .= ' '.\strtolower($name[$i]);
104 104
             } else {
105 105
                 $isNumeric = \is_numeric($name[$i]);
106 106
 
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class HtmlResultPrinter extends ResultPrinter
16 16
 {
17
-    /**
18
-     * @var string
19
-     */
20
-    private $pageHeader = <<<EOT
17
+	/**
18
+	 * @var string
19
+	 */
20
+	private $pageHeader = <<<EOT
21 21
 <!doctype html>
22 22
 <html lang="en">
23 23
     <head>
@@ -50,89 +50,89 @@  discard block
 block discarded – undo
50 50
     <body>
51 51
 EOT;
52 52
 
53
-    /**
54
-     * @var string
55
-     */
56
-    private $classHeader = <<<EOT
53
+	/**
54
+	 * @var string
55
+	 */
56
+	private $classHeader = <<<EOT
57 57
 
58 58
         <h2 id="%s">%s</h2>
59 59
         <ul>
60 60
 
61 61
 EOT;
62 62
 
63
-    /**
64
-     * @var string
65
-     */
66
-    private $classFooter = <<<EOT
63
+	/**
64
+	 * @var string
65
+	 */
66
+	private $classFooter = <<<EOT
67 67
         </ul>
68 68
 EOT;
69 69
 
70
-    /**
71
-     * @var string
72
-     */
73
-    private $pageFooter = <<<EOT
70
+	/**
71
+	 * @var string
72
+	 */
73
+	private $pageFooter = <<<EOT
74 74
 
75 75
     </body>
76 76
 </html>
77 77
 EOT;
78 78
 
79
-    /**
80
-     * Handler for 'start run' event.
81
-     */
82
-    protected function startRun()
83
-    {
84
-        $this->write($this->pageHeader);
85
-    }
79
+	/**
80
+	 * Handler for 'start run' event.
81
+	 */
82
+	protected function startRun()
83
+	{
84
+		$this->write($this->pageHeader);
85
+	}
86 86
 
87
-    /**
88
-     * Handler for 'start class' event.
89
-     *
90
-     * @param string $name
91
-     */
92
-    protected function startClass($name)
93
-    {
94
-        $this->write(
95
-            \sprintf(
96
-                $this->classHeader,
97
-                $name,
98
-                $this->currentTestClassPrettified
99
-            )
100
-        );
101
-    }
87
+	/**
88
+	 * Handler for 'start class' event.
89
+	 *
90
+	 * @param string $name
91
+	 */
92
+	protected function startClass($name)
93
+	{
94
+		$this->write(
95
+			\sprintf(
96
+				$this->classHeader,
97
+				$name,
98
+				$this->currentTestClassPrettified
99
+			)
100
+		);
101
+	}
102 102
 
103
-    /**
104
-     * Handler for 'on test' event.
105
-     *
106
-     * @param string $name
107
-     * @param bool   $success
108
-     */
109
-    protected function onTest($name, $success = true)
110
-    {
111
-        $this->write(
112
-            \sprintf(
113
-                "            <li style=\"color: %s;\">%s %s</li>\n",
114
-                $success ? '#555753' : '#ef2929',
115
-                $success ? '✓' : '❌',
116
-                $name
117
-            )
118
-        );
119
-    }
103
+	/**
104
+	 * Handler for 'on test' event.
105
+	 *
106
+	 * @param string $name
107
+	 * @param bool   $success
108
+	 */
109
+	protected function onTest($name, $success = true)
110
+	{
111
+		$this->write(
112
+			\sprintf(
113
+				"            <li style=\"color: %s;\">%s %s</li>\n",
114
+				$success ? '#555753' : '#ef2929',
115
+				$success ? '✓' : '❌',
116
+				$name
117
+			)
118
+		);
119
+	}
120 120
 
121
-    /**
122
-     * Handler for 'end class' event.
123
-     *
124
-     * @param string $name
125
-     */
126
-    protected function endClass($name)
127
-    {
128
-        $this->write($this->classFooter);
129
-    }
121
+	/**
122
+	 * Handler for 'end class' event.
123
+	 *
124
+	 * @param string $name
125
+	 */
126
+	protected function endClass($name)
127
+	{
128
+		$this->write($this->classFooter);
129
+	}
130 130
 
131
-    /**
132
-     * Handler for 'end run' event.
133
-     */
134
-    protected function endRun()
135
-    {
136
-        $this->write($this->pageFooter);
137
-    }
131
+	/**
132
+	 * Handler for 'end run' event.
133
+	 */
134
+	protected function endRun()
135
+	{
136
+		$this->write($this->pageFooter);
137
+	}
138 138
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php 2 patches
Indentation   +385 added lines, -385 removed lines patch added patch discarded remove patch
@@ -24,389 +24,389 @@
 block discarded – undo
24 24
  */
25 25
 abstract class ResultPrinter extends Printer implements TestListener
26 26
 {
27
-    /**
28
-     * @var NamePrettifier
29
-     */
30
-    protected $prettifier;
31
-
32
-    /**
33
-     * @var string
34
-     */
35
-    protected $testClass = '';
36
-
37
-    /**
38
-     * @var int
39
-     */
40
-    protected $testStatus;
41
-
42
-    /**
43
-     * @var array
44
-     */
45
-    protected $tests = [];
46
-
47
-    /**
48
-     * @var int
49
-     */
50
-    protected $successful = 0;
51
-
52
-    /**
53
-     * @var int
54
-     */
55
-    protected $warned = 0;
56
-
57
-    /**
58
-     * @var int
59
-     */
60
-    protected $failed = 0;
61
-
62
-    /**
63
-     * @var int
64
-     */
65
-    protected $risky = 0;
66
-
67
-    /**
68
-     * @var int
69
-     */
70
-    protected $skipped = 0;
71
-
72
-    /**
73
-     * @var int
74
-     */
75
-    protected $incomplete = 0;
76
-
77
-    /**
78
-     * @var string|null
79
-     */
80
-    protected $currentTestClassPrettified;
81
-
82
-    /**
83
-     * @var string|null
84
-     */
85
-    protected $currentTestMethodPrettified;
86
-
87
-    /**
88
-     * @var array
89
-     */
90
-    private $groups;
91
-
92
-    /**
93
-     * @var array
94
-     */
95
-    private $excludeGroups;
96
-
97
-    /**
98
-     * @param resource $out
99
-     * @param array    $groups
100
-     * @param array    $excludeGroups
101
-     */
102
-    public function __construct($out = null, array $groups = [], array $excludeGroups = [])
103
-    {
104
-        parent::__construct($out);
105
-
106
-        $this->groups        = $groups;
107
-        $this->excludeGroups = $excludeGroups;
108
-
109
-        $this->prettifier = new NamePrettifier;
110
-        $this->startRun();
111
-    }
112
-
113
-    /**
114
-     * Flush buffer and close output.
115
-     */
116
-    public function flush()
117
-    {
118
-        $this->doEndClass();
119
-        $this->endRun();
120
-
121
-        parent::flush();
122
-    }
123
-
124
-    /**
125
-     * An error occurred.
126
-     *
127
-     * @param Test       $test
128
-     * @param \Exception $e
129
-     * @param float      $time
130
-     */
131
-    public function addError(Test $test, \Exception $e, $time)
132
-    {
133
-        if (!$this->isOfInterest($test)) {
134
-            return;
135
-        }
136
-
137
-        $this->testStatus = BaseTestRunner::STATUS_ERROR;
138
-        $this->failed++;
139
-    }
140
-
141
-    /**
142
-     * A warning occurred.
143
-     *
144
-     * @param Test    $test
145
-     * @param Warning $e
146
-     * @param float   $time
147
-     */
148
-    public function addWarning(Test $test, Warning $e, $time)
149
-    {
150
-        if (!$this->isOfInterest($test)) {
151
-            return;
152
-        }
153
-
154
-        $this->testStatus = BaseTestRunner::STATUS_WARNING;
155
-        $this->warned++;
156
-    }
157
-
158
-    /**
159
-     * A failure occurred.
160
-     *
161
-     * @param Test                 $test
162
-     * @param AssertionFailedError $e
163
-     * @param float                $time
164
-     */
165
-    public function addFailure(Test $test, AssertionFailedError $e, $time)
166
-    {
167
-        if (!$this->isOfInterest($test)) {
168
-            return;
169
-        }
170
-
171
-        $this->testStatus = BaseTestRunner::STATUS_FAILURE;
172
-        $this->failed++;
173
-    }
174
-
175
-    /**
176
-     * Incomplete test.
177
-     *
178
-     * @param Test       $test
179
-     * @param \Exception $e
180
-     * @param float      $time
181
-     */
182
-    public function addIncompleteTest(Test $test, \Exception $e, $time)
183
-    {
184
-        if (!$this->isOfInterest($test)) {
185
-            return;
186
-        }
187
-
188
-        $this->testStatus = BaseTestRunner::STATUS_INCOMPLETE;
189
-        $this->incomplete++;
190
-    }
191
-
192
-    /**
193
-     * Risky test.
194
-     *
195
-     * @param Test       $test
196
-     * @param \Exception $e
197
-     * @param float      $time
198
-     */
199
-    public function addRiskyTest(Test $test, \Exception $e, $time)
200
-    {
201
-        if (!$this->isOfInterest($test)) {
202
-            return;
203
-        }
204
-
205
-        $this->testStatus = BaseTestRunner::STATUS_RISKY;
206
-        $this->risky++;
207
-    }
208
-
209
-    /**
210
-     * Skipped test.
211
-     *
212
-     * @param Test       $test
213
-     * @param \Exception $e
214
-     * @param float      $time
215
-     */
216
-    public function addSkippedTest(Test $test, \Exception $e, $time)
217
-    {
218
-        if (!$this->isOfInterest($test)) {
219
-            return;
220
-        }
221
-
222
-        $this->testStatus = BaseTestRunner::STATUS_SKIPPED;
223
-        $this->skipped++;
224
-    }
225
-
226
-    /**
227
-     * A testsuite started.
228
-     *
229
-     * @param TestSuite $suite
230
-     */
231
-    public function startTestSuite(TestSuite $suite)
232
-    {
233
-    }
234
-
235
-    /**
236
-     * A testsuite ended.
237
-     *
238
-     * @param TestSuite $suite
239
-     */
240
-    public function endTestSuite(TestSuite $suite)
241
-    {
242
-    }
243
-
244
-    /**
245
-     * A test started.
246
-     *
247
-     * @param Test $test
248
-     */
249
-    public function startTest(Test $test)
250
-    {
251
-        if (!$this->isOfInterest($test)) {
252
-            return;
253
-        }
254
-
255
-        $class = \get_class($test);
256
-
257
-        if ($this->testClass != $class) {
258
-            if ($this->testClass != '') {
259
-                $this->doEndClass();
260
-            }
261
-
262
-            $classAnnotations = \PHPUnit\Util\Test::parseTestMethodAnnotations($class);
263
-            if (isset($classAnnotations['class']['testdox'][0])) {
264
-                $this->currentTestClassPrettified = $classAnnotations['class']['testdox'][0];
265
-            } else {
266
-                $this->currentTestClassPrettified = $this->prettifier->prettifyTestClass($class);
267
-            }
268
-
269
-            $this->startClass($class);
270
-
271
-            $this->testClass = $class;
272
-            $this->tests     = [];
273
-        }
274
-
275
-        if ($test instanceof TestCase) {
276
-            $annotations = $test->getAnnotations();
277
-
278
-            if (isset($annotations['method']['testdox'][0])) {
279
-                $this->currentTestMethodPrettified = $annotations['method']['testdox'][0];
280
-            } else {
281
-                $this->currentTestMethodPrettified = $this->prettifier->prettifyTestMethod($test->getName(false));
282
-            }
283
-
284
-            if ($test->usesDataProvider()) {
285
-                $this->currentTestMethodPrettified .= ' ' . $test->dataDescription();
286
-            }
287
-        }
288
-
289
-        $this->testStatus = BaseTestRunner::STATUS_PASSED;
290
-    }
291
-
292
-    /**
293
-     * A test ended.
294
-     *
295
-     * @param Test  $test
296
-     * @param float $time
297
-     */
298
-    public function endTest(Test $test, $time)
299
-    {
300
-        if (!$this->isOfInterest($test)) {
301
-            return;
302
-        }
303
-
304
-        if (!isset($this->tests[$this->currentTestMethodPrettified])) {
305
-            if ($this->testStatus == BaseTestRunner::STATUS_PASSED) {
306
-                $this->tests[$this->currentTestMethodPrettified]['success'] = 1;
307
-                $this->tests[$this->currentTestMethodPrettified]['failure'] = 0;
308
-            } else {
309
-                $this->tests[$this->currentTestMethodPrettified]['success'] = 0;
310
-                $this->tests[$this->currentTestMethodPrettified]['failure'] = 1;
311
-            }
312
-        } else {
313
-            if ($this->testStatus == BaseTestRunner::STATUS_PASSED) {
314
-                $this->tests[$this->currentTestMethodPrettified]['success']++;
315
-            } else {
316
-                $this->tests[$this->currentTestMethodPrettified]['failure']++;
317
-            }
318
-        }
319
-
320
-        $this->currentTestClassPrettified  = null;
321
-        $this->currentTestMethodPrettified = null;
322
-    }
323
-
324
-    protected function doEndClass()
325
-    {
326
-        foreach ($this->tests as $name => $data) {
327
-            $this->onTest($name, $data['failure'] == 0);
328
-        }
329
-
330
-        $this->endClass($this->testClass);
331
-    }
332
-
333
-    /**
334
-     * Handler for 'start run' event.
335
-     */
336
-    protected function startRun()
337
-    {
338
-    }
339
-
340
-    /**
341
-     * Handler for 'start class' event.
342
-     *
343
-     * @param string $name
344
-     */
345
-    protected function startClass($name)
346
-    {
347
-    }
348
-
349
-    /**
350
-     * Handler for 'on test' event.
351
-     *
352
-     * @param string $name
353
-     * @param bool   $success
354
-     */
355
-    protected function onTest($name, $success = true)
356
-    {
357
-    }
358
-
359
-    /**
360
-     * Handler for 'end class' event.
361
-     *
362
-     * @param string $name
363
-     */
364
-    protected function endClass($name)
365
-    {
366
-    }
367
-
368
-    /**
369
-     * Handler for 'end run' event.
370
-     */
371
-    protected function endRun()
372
-    {
373
-    }
374
-
375
-    /**
376
-     * @param Test $test
377
-     *
378
-     * @return bool
379
-     */
380
-    private function isOfInterest(Test $test)
381
-    {
382
-        if (!$test instanceof TestCase) {
383
-            return false;
384
-        }
385
-
386
-        if ($test instanceof WarningTestCase) {
387
-            return false;
388
-        }
389
-
390
-        if (!empty($this->groups)) {
391
-            foreach ($test->getGroups() as $group) {
392
-                if (\in_array($group, $this->groups)) {
393
-                    return true;
394
-                }
395
-            }
396
-
397
-            return false;
398
-        }
399
-
400
-        if (!empty($this->excludeGroups)) {
401
-            foreach ($test->getGroups() as $group) {
402
-                if (\in_array($group, $this->excludeGroups)) {
403
-                    return false;
404
-                }
405
-            }
406
-
407
-            return true;
408
-        }
409
-
410
-        return true;
411
-    }
27
+	/**
28
+	 * @var NamePrettifier
29
+	 */
30
+	protected $prettifier;
31
+
32
+	/**
33
+	 * @var string
34
+	 */
35
+	protected $testClass = '';
36
+
37
+	/**
38
+	 * @var int
39
+	 */
40
+	protected $testStatus;
41
+
42
+	/**
43
+	 * @var array
44
+	 */
45
+	protected $tests = [];
46
+
47
+	/**
48
+	 * @var int
49
+	 */
50
+	protected $successful = 0;
51
+
52
+	/**
53
+	 * @var int
54
+	 */
55
+	protected $warned = 0;
56
+
57
+	/**
58
+	 * @var int
59
+	 */
60
+	protected $failed = 0;
61
+
62
+	/**
63
+	 * @var int
64
+	 */
65
+	protected $risky = 0;
66
+
67
+	/**
68
+	 * @var int
69
+	 */
70
+	protected $skipped = 0;
71
+
72
+	/**
73
+	 * @var int
74
+	 */
75
+	protected $incomplete = 0;
76
+
77
+	/**
78
+	 * @var string|null
79
+	 */
80
+	protected $currentTestClassPrettified;
81
+
82
+	/**
83
+	 * @var string|null
84
+	 */
85
+	protected $currentTestMethodPrettified;
86
+
87
+	/**
88
+	 * @var array
89
+	 */
90
+	private $groups;
91
+
92
+	/**
93
+	 * @var array
94
+	 */
95
+	private $excludeGroups;
96
+
97
+	/**
98
+	 * @param resource $out
99
+	 * @param array    $groups
100
+	 * @param array    $excludeGroups
101
+	 */
102
+	public function __construct($out = null, array $groups = [], array $excludeGroups = [])
103
+	{
104
+		parent::__construct($out);
105
+
106
+		$this->groups        = $groups;
107
+		$this->excludeGroups = $excludeGroups;
108
+
109
+		$this->prettifier = new NamePrettifier;
110
+		$this->startRun();
111
+	}
112
+
113
+	/**
114
+	 * Flush buffer and close output.
115
+	 */
116
+	public function flush()
117
+	{
118
+		$this->doEndClass();
119
+		$this->endRun();
120
+
121
+		parent::flush();
122
+	}
123
+
124
+	/**
125
+	 * An error occurred.
126
+	 *
127
+	 * @param Test       $test
128
+	 * @param \Exception $e
129
+	 * @param float      $time
130
+	 */
131
+	public function addError(Test $test, \Exception $e, $time)
132
+	{
133
+		if (!$this->isOfInterest($test)) {
134
+			return;
135
+		}
136
+
137
+		$this->testStatus = BaseTestRunner::STATUS_ERROR;
138
+		$this->failed++;
139
+	}
140
+
141
+	/**
142
+	 * A warning occurred.
143
+	 *
144
+	 * @param Test    $test
145
+	 * @param Warning $e
146
+	 * @param float   $time
147
+	 */
148
+	public function addWarning(Test $test, Warning $e, $time)
149
+	{
150
+		if (!$this->isOfInterest($test)) {
151
+			return;
152
+		}
153
+
154
+		$this->testStatus = BaseTestRunner::STATUS_WARNING;
155
+		$this->warned++;
156
+	}
157
+
158
+	/**
159
+	 * A failure occurred.
160
+	 *
161
+	 * @param Test                 $test
162
+	 * @param AssertionFailedError $e
163
+	 * @param float                $time
164
+	 */
165
+	public function addFailure(Test $test, AssertionFailedError $e, $time)
166
+	{
167
+		if (!$this->isOfInterest($test)) {
168
+			return;
169
+		}
170
+
171
+		$this->testStatus = BaseTestRunner::STATUS_FAILURE;
172
+		$this->failed++;
173
+	}
174
+
175
+	/**
176
+	 * Incomplete test.
177
+	 *
178
+	 * @param Test       $test
179
+	 * @param \Exception $e
180
+	 * @param float      $time
181
+	 */
182
+	public function addIncompleteTest(Test $test, \Exception $e, $time)
183
+	{
184
+		if (!$this->isOfInterest($test)) {
185
+			return;
186
+		}
187
+
188
+		$this->testStatus = BaseTestRunner::STATUS_INCOMPLETE;
189
+		$this->incomplete++;
190
+	}
191
+
192
+	/**
193
+	 * Risky test.
194
+	 *
195
+	 * @param Test       $test
196
+	 * @param \Exception $e
197
+	 * @param float      $time
198
+	 */
199
+	public function addRiskyTest(Test $test, \Exception $e, $time)
200
+	{
201
+		if (!$this->isOfInterest($test)) {
202
+			return;
203
+		}
204
+
205
+		$this->testStatus = BaseTestRunner::STATUS_RISKY;
206
+		$this->risky++;
207
+	}
208
+
209
+	/**
210
+	 * Skipped test.
211
+	 *
212
+	 * @param Test       $test
213
+	 * @param \Exception $e
214
+	 * @param float      $time
215
+	 */
216
+	public function addSkippedTest(Test $test, \Exception $e, $time)
217
+	{
218
+		if (!$this->isOfInterest($test)) {
219
+			return;
220
+		}
221
+
222
+		$this->testStatus = BaseTestRunner::STATUS_SKIPPED;
223
+		$this->skipped++;
224
+	}
225
+
226
+	/**
227
+	 * A testsuite started.
228
+	 *
229
+	 * @param TestSuite $suite
230
+	 */
231
+	public function startTestSuite(TestSuite $suite)
232
+	{
233
+	}
234
+
235
+	/**
236
+	 * A testsuite ended.
237
+	 *
238
+	 * @param TestSuite $suite
239
+	 */
240
+	public function endTestSuite(TestSuite $suite)
241
+	{
242
+	}
243
+
244
+	/**
245
+	 * A test started.
246
+	 *
247
+	 * @param Test $test
248
+	 */
249
+	public function startTest(Test $test)
250
+	{
251
+		if (!$this->isOfInterest($test)) {
252
+			return;
253
+		}
254
+
255
+		$class = \get_class($test);
256
+
257
+		if ($this->testClass != $class) {
258
+			if ($this->testClass != '') {
259
+				$this->doEndClass();
260
+			}
261
+
262
+			$classAnnotations = \PHPUnit\Util\Test::parseTestMethodAnnotations($class);
263
+			if (isset($classAnnotations['class']['testdox'][0])) {
264
+				$this->currentTestClassPrettified = $classAnnotations['class']['testdox'][0];
265
+			} else {
266
+				$this->currentTestClassPrettified = $this->prettifier->prettifyTestClass($class);
267
+			}
268
+
269
+			$this->startClass($class);
270
+
271
+			$this->testClass = $class;
272
+			$this->tests     = [];
273
+		}
274
+
275
+		if ($test instanceof TestCase) {
276
+			$annotations = $test->getAnnotations();
277
+
278
+			if (isset($annotations['method']['testdox'][0])) {
279
+				$this->currentTestMethodPrettified = $annotations['method']['testdox'][0];
280
+			} else {
281
+				$this->currentTestMethodPrettified = $this->prettifier->prettifyTestMethod($test->getName(false));
282
+			}
283
+
284
+			if ($test->usesDataProvider()) {
285
+				$this->currentTestMethodPrettified .= ' ' . $test->dataDescription();
286
+			}
287
+		}
288
+
289
+		$this->testStatus = BaseTestRunner::STATUS_PASSED;
290
+	}
291
+
292
+	/**
293
+	 * A test ended.
294
+	 *
295
+	 * @param Test  $test
296
+	 * @param float $time
297
+	 */
298
+	public function endTest(Test $test, $time)
299
+	{
300
+		if (!$this->isOfInterest($test)) {
301
+			return;
302
+		}
303
+
304
+		if (!isset($this->tests[$this->currentTestMethodPrettified])) {
305
+			if ($this->testStatus == BaseTestRunner::STATUS_PASSED) {
306
+				$this->tests[$this->currentTestMethodPrettified]['success'] = 1;
307
+				$this->tests[$this->currentTestMethodPrettified]['failure'] = 0;
308
+			} else {
309
+				$this->tests[$this->currentTestMethodPrettified]['success'] = 0;
310
+				$this->tests[$this->currentTestMethodPrettified]['failure'] = 1;
311
+			}
312
+		} else {
313
+			if ($this->testStatus == BaseTestRunner::STATUS_PASSED) {
314
+				$this->tests[$this->currentTestMethodPrettified]['success']++;
315
+			} else {
316
+				$this->tests[$this->currentTestMethodPrettified]['failure']++;
317
+			}
318
+		}
319
+
320
+		$this->currentTestClassPrettified  = null;
321
+		$this->currentTestMethodPrettified = null;
322
+	}
323
+
324
+	protected function doEndClass()
325
+	{
326
+		foreach ($this->tests as $name => $data) {
327
+			$this->onTest($name, $data['failure'] == 0);
328
+		}
329
+
330
+		$this->endClass($this->testClass);
331
+	}
332
+
333
+	/**
334
+	 * Handler for 'start run' event.
335
+	 */
336
+	protected function startRun()
337
+	{
338
+	}
339
+
340
+	/**
341
+	 * Handler for 'start class' event.
342
+	 *
343
+	 * @param string $name
344
+	 */
345
+	protected function startClass($name)
346
+	{
347
+	}
348
+
349
+	/**
350
+	 * Handler for 'on test' event.
351
+	 *
352
+	 * @param string $name
353
+	 * @param bool   $success
354
+	 */
355
+	protected function onTest($name, $success = true)
356
+	{
357
+	}
358
+
359
+	/**
360
+	 * Handler for 'end class' event.
361
+	 *
362
+	 * @param string $name
363
+	 */
364
+	protected function endClass($name)
365
+	{
366
+	}
367
+
368
+	/**
369
+	 * Handler for 'end run' event.
370
+	 */
371
+	protected function endRun()
372
+	{
373
+	}
374
+
375
+	/**
376
+	 * @param Test $test
377
+	 *
378
+	 * @return bool
379
+	 */
380
+	private function isOfInterest(Test $test)
381
+	{
382
+		if (!$test instanceof TestCase) {
383
+			return false;
384
+		}
385
+
386
+		if ($test instanceof WarningTestCase) {
387
+			return false;
388
+		}
389
+
390
+		if (!empty($this->groups)) {
391
+			foreach ($test->getGroups() as $group) {
392
+				if (\in_array($group, $this->groups)) {
393
+					return true;
394
+				}
395
+			}
396
+
397
+			return false;
398
+		}
399
+
400
+		if (!empty($this->excludeGroups)) {
401
+			foreach ($test->getGroups() as $group) {
402
+				if (\in_array($group, $this->excludeGroups)) {
403
+					return false;
404
+				}
405
+			}
406
+
407
+			return true;
408
+		}
409
+
410
+		return true;
411
+	}
412 412
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@
 block discarded – undo
282 282
             }
283 283
 
284 284
             if ($test->usesDataProvider()) {
285
-                $this->currentTestMethodPrettified .= ' ' . $test->dataDescription();
285
+                $this->currentTestMethodPrettified .= ' '.$test->dataDescription();
286 286
             }
287 287
         }
288 288
 
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Util/Printer.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -16,131 +16,131 @@
 block discarded – undo
16 16
  */
17 17
 class Printer
18 18
 {
19
-    /**
20
-     * If true, flush output after every write.
21
-     *
22
-     * @var bool
23
-     */
24
-    protected $autoFlush = false;
25
-
26
-    /**
27
-     * @var resource
28
-     */
29
-    protected $out;
30
-
31
-    /**
32
-     * @var string
33
-     */
34
-    protected $outTarget;
35
-
36
-    /**
37
-     * Constructor.
38
-     *
39
-     * @param mixed $out
40
-     *
41
-     * @throws Exception
42
-     */
43
-    public function __construct($out = null)
44
-    {
45
-        if ($out !== null) {
46
-            if (\is_string($out)) {
47
-                if (\strpos($out, 'socket://') === 0) {
48
-                    $out = \explode(':', \str_replace('socket://', '', $out));
49
-
50
-                    if (\count($out) != 2) {
51
-                        throw new Exception;
52
-                    }
53
-
54
-                    $this->out = \fsockopen($out[0], $out[1]);
55
-                } else {
56
-                    if (\strpos($out, 'php://') === false && !\is_dir(\dirname($out))) {
57
-                        \mkdir(\dirname($out), 0777, true);
58
-                    }
59
-
60
-                    $this->out = \fopen($out, 'wt');
61
-                }
62
-
63
-                $this->outTarget = $out;
64
-            } else {
65
-                $this->out = $out;
66
-            }
67
-        }
68
-    }
69
-
70
-    /**
71
-     * Flush buffer and close output if it's not to a PHP stream
72
-     */
73
-    public function flush()
74
-    {
75
-        if ($this->out && \strncmp($this->outTarget, 'php://', 6) !== 0) {
76
-            \fclose($this->out);
77
-        }
78
-    }
79
-
80
-    /**
81
-     * Performs a safe, incremental flush.
82
-     *
83
-     * Do not confuse this function with the flush() function of this class,
84
-     * since the flush() function may close the file being written to, rendering
85
-     * the current object no longer usable.
86
-     */
87
-    public function incrementalFlush()
88
-    {
89
-        if ($this->out) {
90
-            \fflush($this->out);
91
-        } else {
92
-            \flush();
93
-        }
94
-    }
95
-
96
-    /**
97
-     * @param string $buffer
98
-     */
99
-    public function write($buffer)
100
-    {
101
-        if ($this->out) {
102
-            \fwrite($this->out, $buffer);
103
-
104
-            if ($this->autoFlush) {
105
-                $this->incrementalFlush();
106
-            }
107
-        } else {
108
-            if (PHP_SAPI != 'cli' && PHP_SAPI != 'phpdbg') {
109
-                $buffer = \htmlspecialchars($buffer, ENT_SUBSTITUTE);
110
-            }
111
-
112
-            print $buffer;
113
-
114
-            if ($this->autoFlush) {
115
-                $this->incrementalFlush();
116
-            }
117
-        }
118
-    }
119
-
120
-    /**
121
-     * Check auto-flush mode.
122
-     *
123
-     * @return bool
124
-     */
125
-    public function getAutoFlush()
126
-    {
127
-        return $this->autoFlush;
128
-    }
129
-
130
-    /**
131
-     * Set auto-flushing mode.
132
-     *
133
-     * If set, *incremental* flushes will be done after each write. This should
134
-     * not be confused with the different effects of this class' flush() method.
135
-     *
136
-     * @param bool $autoFlush
137
-     */
138
-    public function setAutoFlush($autoFlush)
139
-    {
140
-        if (\is_bool($autoFlush)) {
141
-            $this->autoFlush = $autoFlush;
142
-        } else {
143
-            throw InvalidArgumentHelper::factory(1, 'boolean');
144
-        }
145
-    }
19
+	/**
20
+	 * If true, flush output after every write.
21
+	 *
22
+	 * @var bool
23
+	 */
24
+	protected $autoFlush = false;
25
+
26
+	/**
27
+	 * @var resource
28
+	 */
29
+	protected $out;
30
+
31
+	/**
32
+	 * @var string
33
+	 */
34
+	protected $outTarget;
35
+
36
+	/**
37
+	 * Constructor.
38
+	 *
39
+	 * @param mixed $out
40
+	 *
41
+	 * @throws Exception
42
+	 */
43
+	public function __construct($out = null)
44
+	{
45
+		if ($out !== null) {
46
+			if (\is_string($out)) {
47
+				if (\strpos($out, 'socket://') === 0) {
48
+					$out = \explode(':', \str_replace('socket://', '', $out));
49
+
50
+					if (\count($out) != 2) {
51
+						throw new Exception;
52
+					}
53
+
54
+					$this->out = \fsockopen($out[0], $out[1]);
55
+				} else {
56
+					if (\strpos($out, 'php://') === false && !\is_dir(\dirname($out))) {
57
+						\mkdir(\dirname($out), 0777, true);
58
+					}
59
+
60
+					$this->out = \fopen($out, 'wt');
61
+				}
62
+
63
+				$this->outTarget = $out;
64
+			} else {
65
+				$this->out = $out;
66
+			}
67
+		}
68
+	}
69
+
70
+	/**
71
+	 * Flush buffer and close output if it's not to a PHP stream
72
+	 */
73
+	public function flush()
74
+	{
75
+		if ($this->out && \strncmp($this->outTarget, 'php://', 6) !== 0) {
76
+			\fclose($this->out);
77
+		}
78
+	}
79
+
80
+	/**
81
+	 * Performs a safe, incremental flush.
82
+	 *
83
+	 * Do not confuse this function with the flush() function of this class,
84
+	 * since the flush() function may close the file being written to, rendering
85
+	 * the current object no longer usable.
86
+	 */
87
+	public function incrementalFlush()
88
+	{
89
+		if ($this->out) {
90
+			\fflush($this->out);
91
+		} else {
92
+			\flush();
93
+		}
94
+	}
95
+
96
+	/**
97
+	 * @param string $buffer
98
+	 */
99
+	public function write($buffer)
100
+	{
101
+		if ($this->out) {
102
+			\fwrite($this->out, $buffer);
103
+
104
+			if ($this->autoFlush) {
105
+				$this->incrementalFlush();
106
+			}
107
+		} else {
108
+			if (PHP_SAPI != 'cli' && PHP_SAPI != 'phpdbg') {
109
+				$buffer = \htmlspecialchars($buffer, ENT_SUBSTITUTE);
110
+			}
111
+
112
+			print $buffer;
113
+
114
+			if ($this->autoFlush) {
115
+				$this->incrementalFlush();
116
+			}
117
+		}
118
+	}
119
+
120
+	/**
121
+	 * Check auto-flush mode.
122
+	 *
123
+	 * @return bool
124
+	 */
125
+	public function getAutoFlush()
126
+	{
127
+		return $this->autoFlush;
128
+	}
129
+
130
+	/**
131
+	 * Set auto-flushing mode.
132
+	 *
133
+	 * If set, *incremental* flushes will be done after each write. This should
134
+	 * not be confused with the different effects of this class' flush() method.
135
+	 *
136
+	 * @param bool $autoFlush
137
+	 */
138
+	public function setAutoFlush($autoFlush)
139
+	{
140
+		if (\is_bool($autoFlush)) {
141
+			$this->autoFlush = $autoFlush;
142
+		} else {
143
+			throw InvalidArgumentHelper::factory(1, 'boolean');
144
+		}
145
+	}
146 146
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Util/Configuration.php 2 patches
Indentation   +1052 added lines, -1052 removed lines patch added patch discarded remove patch
@@ -150,1059 +150,1059 @@
 block discarded – undo
150 150
  */
151 151
 class Configuration
152 152
 {
153
-    const TEST_SUITE_FILTER_SEPARATOR = ',';
154
-
155
-    private static $instances = [];
156
-
157
-    protected $document;
158
-    protected $xpath;
159
-    protected $filename;
160
-
161
-    /**
162
-     * Loads a PHPUnit configuration file.
163
-     *
164
-     * @param string $filename
165
-     */
166
-    protected function __construct($filename)
167
-    {
168
-        $this->filename = $filename;
169
-        $this->document = Xml::loadFile($filename, false, true, true);
170
-        $this->xpath    = new DOMXPath($this->document);
171
-    }
172
-
173
-    final private function __clone()
174
-    {
175
-    }
176
-
177
-    /**
178
-     * Returns a PHPUnit configuration object.
179
-     *
180
-     * @param string $filename
181
-     *
182
-     * @return Configuration
183
-     */
184
-    public static function getInstance($filename)
185
-    {
186
-        $realpath = \realpath($filename);
187
-
188
-        if ($realpath === false) {
189
-            throw new Exception(
190
-                \sprintf(
191
-                    'Could not read "%s".',
192
-                    $filename
193
-                )
194
-            );
195
-        }
196
-
197
-        if (!isset(self::$instances[$realpath])) {
198
-            self::$instances[$realpath] = new self($realpath);
199
-        }
200
-
201
-        return self::$instances[$realpath];
202
-    }
203
-
204
-    /**
205
-     * Returns the realpath to the configuration file.
206
-     *
207
-     * @return string
208
-     */
209
-    public function getFilename()
210
-    {
211
-        return $this->filename;
212
-    }
213
-
214
-    /**
215
-     * Returns the configuration for SUT filtering.
216
-     *
217
-     * @return array
218
-     */
219
-    public function getFilterConfiguration()
220
-    {
221
-        $addUncoveredFilesFromWhitelist     = true;
222
-        $processUncoveredFilesFromWhitelist = false;
223
-
224
-        $tmp = $this->xpath->query('filter/whitelist');
225
-
226
-        if ($tmp->length == 0) {
227
-            return [
228
-                'whitelist' => [
229
-                    'addUncoveredFilesFromWhitelist'     => $addUncoveredFilesFromWhitelist,
230
-                    'processUncoveredFilesFromWhitelist' => $processUncoveredFilesFromWhitelist,
231
-                    'include'                            => [
232
-                        'directory' => [],
233
-                        'file'      => []
234
-                    ],
235
-                    'exclude' => [
236
-                        'directory' => [],
237
-                        'file'      => []
238
-                    ]
239
-                ]
240
-            ];
241
-        }
242
-
243
-        if ($tmp->length == 1) {
244
-            if ($tmp->item(0)->hasAttribute('addUncoveredFilesFromWhitelist')) {
245
-                $addUncoveredFilesFromWhitelist = $this->getBoolean(
246
-                    (string) $tmp->item(0)->getAttribute(
247
-                        'addUncoveredFilesFromWhitelist'
248
-                    ),
249
-                    true
250
-                );
251
-            }
252
-
253
-            if ($tmp->item(0)->hasAttribute('processUncoveredFilesFromWhitelist')) {
254
-                $processUncoveredFilesFromWhitelist = $this->getBoolean(
255
-                    (string) $tmp->item(0)->getAttribute(
256
-                        'processUncoveredFilesFromWhitelist'
257
-                    ),
258
-                    false
259
-                );
260
-            }
261
-        }
262
-
263
-        return [
264
-            'whitelist' => [
265
-                'addUncoveredFilesFromWhitelist'     => $addUncoveredFilesFromWhitelist,
266
-                'processUncoveredFilesFromWhitelist' => $processUncoveredFilesFromWhitelist,
267
-                'include'                            => [
268
-                    'directory' => $this->readFilterDirectories(
269
-                        'filter/whitelist/directory'
270
-                    ),
271
-                    'file' => $this->readFilterFiles(
272
-                        'filter/whitelist/file'
273
-                    )
274
-                ],
275
-                'exclude' => [
276
-                    'directory' => $this->readFilterDirectories(
277
-                        'filter/whitelist/exclude/directory'
278
-                    ),
279
-                    'file' => $this->readFilterFiles(
280
-                        'filter/whitelist/exclude/file'
281
-                    )
282
-                ]
283
-            ]
284
-        ];
285
-    }
286
-
287
-    /**
288
-     * Returns the configuration for groups.
289
-     *
290
-     * @return array
291
-     */
292
-    public function getGroupConfiguration()
293
-    {
294
-        return $this->parseGroupConfiguration('groups');
295
-    }
296
-
297
-    /**
298
-     * Returns the configuration for testdox groups.
299
-     *
300
-     * @return array
301
-     */
302
-    public function getTestdoxGroupConfiguration()
303
-    {
304
-        return $this->parseGroupConfiguration('testdoxGroups');
305
-    }
306
-
307
-    /**
308
-     * @param string $root
309
-     *
310
-     * @return array
311
-     */
312
-    private function parseGroupConfiguration($root)
313
-    {
314
-        $groups = [
315
-            'include' => [],
316
-            'exclude' => []
317
-        ];
318
-
319
-        foreach ($this->xpath->query($root . '/include/group') as $group) {
320
-            $groups['include'][] = (string) $group->textContent;
321
-        }
322
-
323
-        foreach ($this->xpath->query($root . '/exclude/group') as $group) {
324
-            $groups['exclude'][] = (string) $group->textContent;
325
-        }
326
-
327
-        return $groups;
328
-    }
329
-
330
-    /**
331
-     * Returns the configuration for listeners.
332
-     *
333
-     * @return array
334
-     */
335
-    public function getListenerConfiguration()
336
-    {
337
-        $result = [];
338
-
339
-        foreach ($this->xpath->query('listeners/listener') as $listener) {
340
-            $class     = (string) $listener->getAttribute('class');
341
-            $file      = '';
342
-            $arguments = [];
343
-
344
-            if ($listener->getAttribute('file')) {
345
-                $file = $this->toAbsolutePath(
346
-                    (string) $listener->getAttribute('file'),
347
-                    true
348
-                );
349
-            }
350
-
351
-            foreach ($listener->childNodes as $node) {
352
-                if ($node instanceof DOMElement && $node->tagName == 'arguments') {
353
-                    foreach ($node->childNodes as $argument) {
354
-                        if ($argument instanceof DOMElement) {
355
-                            if ($argument->tagName == 'file' || $argument->tagName == 'directory') {
356
-                                $arguments[] = $this->toAbsolutePath((string) $argument->textContent);
357
-                            } else {
358
-                                $arguments[] = Xml::xmlToVariable($argument);
359
-                            }
360
-                        }
361
-                    }
362
-                }
363
-            }
364
-
365
-            $result[] = [
366
-                'class'     => $class,
367
-                'file'      => $file,
368
-                'arguments' => $arguments
369
-            ];
370
-        }
371
-
372
-        return $result;
373
-    }
374
-
375
-    /**
376
-     * Returns the logging configuration.
377
-     *
378
-     * @return array
379
-     */
380
-    public function getLoggingConfiguration()
381
-    {
382
-        $result = [];
383
-
384
-        foreach ($this->xpath->query('logging/log') as $log) {
385
-            $type   = (string) $log->getAttribute('type');
386
-            $target = (string) $log->getAttribute('target');
387
-
388
-            if (!$target) {
389
-                continue;
390
-            }
391
-
392
-            $target = $this->toAbsolutePath($target);
393
-
394
-            if ($type == 'coverage-html') {
395
-                if ($log->hasAttribute('lowUpperBound')) {
396
-                    $result['lowUpperBound'] = $this->getInteger(
397
-                        (string) $log->getAttribute('lowUpperBound'),
398
-                        50
399
-                    );
400
-                }
401
-
402
-                if ($log->hasAttribute('highLowerBound')) {
403
-                    $result['highLowerBound'] = $this->getInteger(
404
-                        (string) $log->getAttribute('highLowerBound'),
405
-                        90
406
-                    );
407
-                }
408
-            } elseif ($type == 'coverage-crap4j') {
409
-                if ($log->hasAttribute('threshold')) {
410
-                    $result['crap4jThreshold'] = $this->getInteger(
411
-                        (string) $log->getAttribute('threshold'),
412
-                        30
413
-                    );
414
-                }
415
-            } elseif ($type == 'coverage-text') {
416
-                if ($log->hasAttribute('showUncoveredFiles')) {
417
-                    $result['coverageTextShowUncoveredFiles'] = $this->getBoolean(
418
-                        (string) $log->getAttribute('showUncoveredFiles'),
419
-                        false
420
-                    );
421
-                }
422
-                if ($log->hasAttribute('showOnlySummary')) {
423
-                    $result['coverageTextShowOnlySummary'] = $this->getBoolean(
424
-                        (string) $log->getAttribute('showOnlySummary'),
425
-                        false
426
-                    );
427
-                }
428
-            }
429
-
430
-            $result[$type] = $target;
431
-        }
432
-
433
-        return $result;
434
-    }
435
-
436
-    /**
437
-     * Returns the PHP configuration.
438
-     *
439
-     * @return array
440
-     */
441
-    public function getPHPConfiguration()
442
-    {
443
-        $result = [
444
-            'include_path' => [],
445
-            'ini'          => [],
446
-            'const'        => [],
447
-            'var'          => [],
448
-            'env'          => [],
449
-            'post'         => [],
450
-            'get'          => [],
451
-            'cookie'       => [],
452
-            'server'       => [],
453
-            'files'        => [],
454
-            'request'      => []
455
-        ];
456
-
457
-        foreach ($this->xpath->query('php/includePath') as $includePath) {
458
-            $path = (string) $includePath->textContent;
459
-
460
-            if ($path) {
461
-                $result['include_path'][] = $this->toAbsolutePath($path);
462
-            }
463
-        }
464
-
465
-        foreach ($this->xpath->query('php/ini') as $ini) {
466
-            $name  = (string) $ini->getAttribute('name');
467
-            $value = (string) $ini->getAttribute('value');
468
-
469
-            $result['ini'][$name]['value'] = $value;
470
-        }
471
-
472
-        foreach ($this->xpath->query('php/const') as $const) {
473
-            $name  = (string) $const->getAttribute('name');
474
-            $value = (string) $const->getAttribute('value');
475
-
476
-            $result['const'][$name]['value'] = $this->getBoolean($value, $value);
477
-        }
478
-
479
-        foreach (['var', 'env', 'post', 'get', 'cookie', 'server', 'files', 'request'] as $array) {
480
-            foreach ($this->xpath->query('php/' . $array) as $var) {
481
-                $name     = (string) $var->getAttribute('name');
482
-                $value    = (string) $var->getAttribute('value');
483
-                $verbatim = false;
484
-                $force    = false;
485
-
486
-                if ($var->hasAttribute('verbatim')) {
487
-                    $verbatim                          = $this->getBoolean($var->getAttribute('verbatim'), false);
488
-                    $result[$array][$name]['verbatim'] = $verbatim;
489
-                }
490
-
491
-                if ($var->hasAttribute('force')) {
492
-                    $force                          = $this->getBoolean($var->getAttribute('force'), false);
493
-                    $result[$array][$name]['force'] = $force;
494
-                }
495
-
496
-                if (!$verbatim) {
497
-                    $value = $this->getBoolean($value, $value);
498
-                }
499
-
500
-                $result[$array][$name]['value'] = $value;
501
-            }
502
-        }
503
-
504
-        return $result;
505
-    }
506
-
507
-    /**
508
-     * Handles the PHP configuration.
509
-     */
510
-    public function handlePHPConfiguration()
511
-    {
512
-        $configuration = $this->getPHPConfiguration();
513
-
514
-        if (!empty($configuration['include_path'])) {
515
-            \ini_set(
516
-                'include_path',
517
-                \implode(PATH_SEPARATOR, $configuration['include_path']) .
518
-                PATH_SEPARATOR .
519
-                \ini_get('include_path')
520
-            );
521
-        }
522
-
523
-        foreach ($configuration['ini'] as $name => $data) {
524
-            $value = $data['value'];
525
-
526
-            if (\defined($value)) {
527
-                $value = (string) \constant($value);
528
-            }
529
-
530
-            \ini_set($name, $value);
531
-        }
532
-
533
-        foreach ($configuration['const'] as $name => $data) {
534
-            $value = $data['value'];
535
-
536
-            if (!\defined($name)) {
537
-                \define($name, $value);
538
-            }
539
-        }
540
-
541
-        foreach (['var', 'post', 'get', 'cookie', 'server', 'files', 'request'] as $array) {
542
-            // See https://github.com/sebastianbergmann/phpunit/issues/277
543
-            switch ($array) {
544
-                case 'var':
545
-                    $target = &$GLOBALS;
546
-
547
-                    break;
548
-
549
-                case 'server':
550
-                    $target = &$_SERVER;
551
-
552
-                    break;
553
-
554
-                default:
555
-                    $target = &$GLOBALS['_' . \strtoupper($array)];
556
-
557
-                    break;
558
-            }
559
-
560
-            foreach ($configuration[$array] as $name => $data) {
561
-                $target[$name] = $data['value'];
562
-            }
563
-        }
564
-
565
-        foreach ($configuration['env'] as $name => $data) {
566
-            $value = $data['value'];
567
-            $force = isset($data['force']) ? $data['force'] : false;
568
-
569
-            if (false === \getenv($name)) {
570
-                \putenv("{$name}={$value}");
571
-            }
572
-
573
-            if (!isset($_ENV[$name])) {
574
-                $_ENV[$name] = $value;
575
-            }
576
-
577
-            if (true === $force) {
578
-                $_ENV[$name] = $value;
579
-            }
580
-        }
581
-    }
582
-
583
-    /**
584
-     * Returns the PHPUnit configuration.
585
-     *
586
-     * @return array
587
-     */
588
-    public function getPHPUnitConfiguration()
589
-    {
590
-        $result = [];
591
-        $root   = $this->document->documentElement;
592
-
593
-        if ($root->hasAttribute('cacheTokens')) {
594
-            $result['cacheTokens'] = $this->getBoolean(
595
-                (string) $root->getAttribute('cacheTokens'),
596
-                false
597
-            );
598
-        }
599
-
600
-        if ($root->hasAttribute('columns')) {
601
-            $columns = (string) $root->getAttribute('columns');
602
-
603
-            if ($columns == 'max') {
604
-                $result['columns'] = 'max';
605
-            } else {
606
-                $result['columns'] = $this->getInteger($columns, 80);
607
-            }
608
-        }
609
-
610
-        if ($root->hasAttribute('colors')) {
611
-            /* only allow boolean for compatibility with previous versions
153
+	const TEST_SUITE_FILTER_SEPARATOR = ',';
154
+
155
+	private static $instances = [];
156
+
157
+	protected $document;
158
+	protected $xpath;
159
+	protected $filename;
160
+
161
+	/**
162
+	 * Loads a PHPUnit configuration file.
163
+	 *
164
+	 * @param string $filename
165
+	 */
166
+	protected function __construct($filename)
167
+	{
168
+		$this->filename = $filename;
169
+		$this->document = Xml::loadFile($filename, false, true, true);
170
+		$this->xpath    = new DOMXPath($this->document);
171
+	}
172
+
173
+	final private function __clone()
174
+	{
175
+	}
176
+
177
+	/**
178
+	 * Returns a PHPUnit configuration object.
179
+	 *
180
+	 * @param string $filename
181
+	 *
182
+	 * @return Configuration
183
+	 */
184
+	public static function getInstance($filename)
185
+	{
186
+		$realpath = \realpath($filename);
187
+
188
+		if ($realpath === false) {
189
+			throw new Exception(
190
+				\sprintf(
191
+					'Could not read "%s".',
192
+					$filename
193
+				)
194
+			);
195
+		}
196
+
197
+		if (!isset(self::$instances[$realpath])) {
198
+			self::$instances[$realpath] = new self($realpath);
199
+		}
200
+
201
+		return self::$instances[$realpath];
202
+	}
203
+
204
+	/**
205
+	 * Returns the realpath to the configuration file.
206
+	 *
207
+	 * @return string
208
+	 */
209
+	public function getFilename()
210
+	{
211
+		return $this->filename;
212
+	}
213
+
214
+	/**
215
+	 * Returns the configuration for SUT filtering.
216
+	 *
217
+	 * @return array
218
+	 */
219
+	public function getFilterConfiguration()
220
+	{
221
+		$addUncoveredFilesFromWhitelist     = true;
222
+		$processUncoveredFilesFromWhitelist = false;
223
+
224
+		$tmp = $this->xpath->query('filter/whitelist');
225
+
226
+		if ($tmp->length == 0) {
227
+			return [
228
+				'whitelist' => [
229
+					'addUncoveredFilesFromWhitelist'     => $addUncoveredFilesFromWhitelist,
230
+					'processUncoveredFilesFromWhitelist' => $processUncoveredFilesFromWhitelist,
231
+					'include'                            => [
232
+						'directory' => [],
233
+						'file'      => []
234
+					],
235
+					'exclude' => [
236
+						'directory' => [],
237
+						'file'      => []
238
+					]
239
+				]
240
+			];
241
+		}
242
+
243
+		if ($tmp->length == 1) {
244
+			if ($tmp->item(0)->hasAttribute('addUncoveredFilesFromWhitelist')) {
245
+				$addUncoveredFilesFromWhitelist = $this->getBoolean(
246
+					(string) $tmp->item(0)->getAttribute(
247
+						'addUncoveredFilesFromWhitelist'
248
+					),
249
+					true
250
+				);
251
+			}
252
+
253
+			if ($tmp->item(0)->hasAttribute('processUncoveredFilesFromWhitelist')) {
254
+				$processUncoveredFilesFromWhitelist = $this->getBoolean(
255
+					(string) $tmp->item(0)->getAttribute(
256
+						'processUncoveredFilesFromWhitelist'
257
+					),
258
+					false
259
+				);
260
+			}
261
+		}
262
+
263
+		return [
264
+			'whitelist' => [
265
+				'addUncoveredFilesFromWhitelist'     => $addUncoveredFilesFromWhitelist,
266
+				'processUncoveredFilesFromWhitelist' => $processUncoveredFilesFromWhitelist,
267
+				'include'                            => [
268
+					'directory' => $this->readFilterDirectories(
269
+						'filter/whitelist/directory'
270
+					),
271
+					'file' => $this->readFilterFiles(
272
+						'filter/whitelist/file'
273
+					)
274
+				],
275
+				'exclude' => [
276
+					'directory' => $this->readFilterDirectories(
277
+						'filter/whitelist/exclude/directory'
278
+					),
279
+					'file' => $this->readFilterFiles(
280
+						'filter/whitelist/exclude/file'
281
+					)
282
+				]
283
+			]
284
+		];
285
+	}
286
+
287
+	/**
288
+	 * Returns the configuration for groups.
289
+	 *
290
+	 * @return array
291
+	 */
292
+	public function getGroupConfiguration()
293
+	{
294
+		return $this->parseGroupConfiguration('groups');
295
+	}
296
+
297
+	/**
298
+	 * Returns the configuration for testdox groups.
299
+	 *
300
+	 * @return array
301
+	 */
302
+	public function getTestdoxGroupConfiguration()
303
+	{
304
+		return $this->parseGroupConfiguration('testdoxGroups');
305
+	}
306
+
307
+	/**
308
+	 * @param string $root
309
+	 *
310
+	 * @return array
311
+	 */
312
+	private function parseGroupConfiguration($root)
313
+	{
314
+		$groups = [
315
+			'include' => [],
316
+			'exclude' => []
317
+		];
318
+
319
+		foreach ($this->xpath->query($root . '/include/group') as $group) {
320
+			$groups['include'][] = (string) $group->textContent;
321
+		}
322
+
323
+		foreach ($this->xpath->query($root . '/exclude/group') as $group) {
324
+			$groups['exclude'][] = (string) $group->textContent;
325
+		}
326
+
327
+		return $groups;
328
+	}
329
+
330
+	/**
331
+	 * Returns the configuration for listeners.
332
+	 *
333
+	 * @return array
334
+	 */
335
+	public function getListenerConfiguration()
336
+	{
337
+		$result = [];
338
+
339
+		foreach ($this->xpath->query('listeners/listener') as $listener) {
340
+			$class     = (string) $listener->getAttribute('class');
341
+			$file      = '';
342
+			$arguments = [];
343
+
344
+			if ($listener->getAttribute('file')) {
345
+				$file = $this->toAbsolutePath(
346
+					(string) $listener->getAttribute('file'),
347
+					true
348
+				);
349
+			}
350
+
351
+			foreach ($listener->childNodes as $node) {
352
+				if ($node instanceof DOMElement && $node->tagName == 'arguments') {
353
+					foreach ($node->childNodes as $argument) {
354
+						if ($argument instanceof DOMElement) {
355
+							if ($argument->tagName == 'file' || $argument->tagName == 'directory') {
356
+								$arguments[] = $this->toAbsolutePath((string) $argument->textContent);
357
+							} else {
358
+								$arguments[] = Xml::xmlToVariable($argument);
359
+							}
360
+						}
361
+					}
362
+				}
363
+			}
364
+
365
+			$result[] = [
366
+				'class'     => $class,
367
+				'file'      => $file,
368
+				'arguments' => $arguments
369
+			];
370
+		}
371
+
372
+		return $result;
373
+	}
374
+
375
+	/**
376
+	 * Returns the logging configuration.
377
+	 *
378
+	 * @return array
379
+	 */
380
+	public function getLoggingConfiguration()
381
+	{
382
+		$result = [];
383
+
384
+		foreach ($this->xpath->query('logging/log') as $log) {
385
+			$type   = (string) $log->getAttribute('type');
386
+			$target = (string) $log->getAttribute('target');
387
+
388
+			if (!$target) {
389
+				continue;
390
+			}
391
+
392
+			$target = $this->toAbsolutePath($target);
393
+
394
+			if ($type == 'coverage-html') {
395
+				if ($log->hasAttribute('lowUpperBound')) {
396
+					$result['lowUpperBound'] = $this->getInteger(
397
+						(string) $log->getAttribute('lowUpperBound'),
398
+						50
399
+					);
400
+				}
401
+
402
+				if ($log->hasAttribute('highLowerBound')) {
403
+					$result['highLowerBound'] = $this->getInteger(
404
+						(string) $log->getAttribute('highLowerBound'),
405
+						90
406
+					);
407
+				}
408
+			} elseif ($type == 'coverage-crap4j') {
409
+				if ($log->hasAttribute('threshold')) {
410
+					$result['crap4jThreshold'] = $this->getInteger(
411
+						(string) $log->getAttribute('threshold'),
412
+						30
413
+					);
414
+				}
415
+			} elseif ($type == 'coverage-text') {
416
+				if ($log->hasAttribute('showUncoveredFiles')) {
417
+					$result['coverageTextShowUncoveredFiles'] = $this->getBoolean(
418
+						(string) $log->getAttribute('showUncoveredFiles'),
419
+						false
420
+					);
421
+				}
422
+				if ($log->hasAttribute('showOnlySummary')) {
423
+					$result['coverageTextShowOnlySummary'] = $this->getBoolean(
424
+						(string) $log->getAttribute('showOnlySummary'),
425
+						false
426
+					);
427
+				}
428
+			}
429
+
430
+			$result[$type] = $target;
431
+		}
432
+
433
+		return $result;
434
+	}
435
+
436
+	/**
437
+	 * Returns the PHP configuration.
438
+	 *
439
+	 * @return array
440
+	 */
441
+	public function getPHPConfiguration()
442
+	{
443
+		$result = [
444
+			'include_path' => [],
445
+			'ini'          => [],
446
+			'const'        => [],
447
+			'var'          => [],
448
+			'env'          => [],
449
+			'post'         => [],
450
+			'get'          => [],
451
+			'cookie'       => [],
452
+			'server'       => [],
453
+			'files'        => [],
454
+			'request'      => []
455
+		];
456
+
457
+		foreach ($this->xpath->query('php/includePath') as $includePath) {
458
+			$path = (string) $includePath->textContent;
459
+
460
+			if ($path) {
461
+				$result['include_path'][] = $this->toAbsolutePath($path);
462
+			}
463
+		}
464
+
465
+		foreach ($this->xpath->query('php/ini') as $ini) {
466
+			$name  = (string) $ini->getAttribute('name');
467
+			$value = (string) $ini->getAttribute('value');
468
+
469
+			$result['ini'][$name]['value'] = $value;
470
+		}
471
+
472
+		foreach ($this->xpath->query('php/const') as $const) {
473
+			$name  = (string) $const->getAttribute('name');
474
+			$value = (string) $const->getAttribute('value');
475
+
476
+			$result['const'][$name]['value'] = $this->getBoolean($value, $value);
477
+		}
478
+
479
+		foreach (['var', 'env', 'post', 'get', 'cookie', 'server', 'files', 'request'] as $array) {
480
+			foreach ($this->xpath->query('php/' . $array) as $var) {
481
+				$name     = (string) $var->getAttribute('name');
482
+				$value    = (string) $var->getAttribute('value');
483
+				$verbatim = false;
484
+				$force    = false;
485
+
486
+				if ($var->hasAttribute('verbatim')) {
487
+					$verbatim                          = $this->getBoolean($var->getAttribute('verbatim'), false);
488
+					$result[$array][$name]['verbatim'] = $verbatim;
489
+				}
490
+
491
+				if ($var->hasAttribute('force')) {
492
+					$force                          = $this->getBoolean($var->getAttribute('force'), false);
493
+					$result[$array][$name]['force'] = $force;
494
+				}
495
+
496
+				if (!$verbatim) {
497
+					$value = $this->getBoolean($value, $value);
498
+				}
499
+
500
+				$result[$array][$name]['value'] = $value;
501
+			}
502
+		}
503
+
504
+		return $result;
505
+	}
506
+
507
+	/**
508
+	 * Handles the PHP configuration.
509
+	 */
510
+	public function handlePHPConfiguration()
511
+	{
512
+		$configuration = $this->getPHPConfiguration();
513
+
514
+		if (!empty($configuration['include_path'])) {
515
+			\ini_set(
516
+				'include_path',
517
+				\implode(PATH_SEPARATOR, $configuration['include_path']) .
518
+				PATH_SEPARATOR .
519
+				\ini_get('include_path')
520
+			);
521
+		}
522
+
523
+		foreach ($configuration['ini'] as $name => $data) {
524
+			$value = $data['value'];
525
+
526
+			if (\defined($value)) {
527
+				$value = (string) \constant($value);
528
+			}
529
+
530
+			\ini_set($name, $value);
531
+		}
532
+
533
+		foreach ($configuration['const'] as $name => $data) {
534
+			$value = $data['value'];
535
+
536
+			if (!\defined($name)) {
537
+				\define($name, $value);
538
+			}
539
+		}
540
+
541
+		foreach (['var', 'post', 'get', 'cookie', 'server', 'files', 'request'] as $array) {
542
+			// See https://github.com/sebastianbergmann/phpunit/issues/277
543
+			switch ($array) {
544
+				case 'var':
545
+					$target = &$GLOBALS;
546
+
547
+					break;
548
+
549
+				case 'server':
550
+					$target = &$_SERVER;
551
+
552
+					break;
553
+
554
+				default:
555
+					$target = &$GLOBALS['_' . \strtoupper($array)];
556
+
557
+					break;
558
+			}
559
+
560
+			foreach ($configuration[$array] as $name => $data) {
561
+				$target[$name] = $data['value'];
562
+			}
563
+		}
564
+
565
+		foreach ($configuration['env'] as $name => $data) {
566
+			$value = $data['value'];
567
+			$force = isset($data['force']) ? $data['force'] : false;
568
+
569
+			if (false === \getenv($name)) {
570
+				\putenv("{$name}={$value}");
571
+			}
572
+
573
+			if (!isset($_ENV[$name])) {
574
+				$_ENV[$name] = $value;
575
+			}
576
+
577
+			if (true === $force) {
578
+				$_ENV[$name] = $value;
579
+			}
580
+		}
581
+	}
582
+
583
+	/**
584
+	 * Returns the PHPUnit configuration.
585
+	 *
586
+	 * @return array
587
+	 */
588
+	public function getPHPUnitConfiguration()
589
+	{
590
+		$result = [];
591
+		$root   = $this->document->documentElement;
592
+
593
+		if ($root->hasAttribute('cacheTokens')) {
594
+			$result['cacheTokens'] = $this->getBoolean(
595
+				(string) $root->getAttribute('cacheTokens'),
596
+				false
597
+			);
598
+		}
599
+
600
+		if ($root->hasAttribute('columns')) {
601
+			$columns = (string) $root->getAttribute('columns');
602
+
603
+			if ($columns == 'max') {
604
+				$result['columns'] = 'max';
605
+			} else {
606
+				$result['columns'] = $this->getInteger($columns, 80);
607
+			}
608
+		}
609
+
610
+		if ($root->hasAttribute('colors')) {
611
+			/* only allow boolean for compatibility with previous versions
612 612
               'always' only allowed from command line */
613
-            if ($this->getBoolean($root->getAttribute('colors'), false)) {
614
-                $result['colors'] = ResultPrinter::COLOR_AUTO;
615
-            } else {
616
-                $result['colors'] = ResultPrinter::COLOR_NEVER;
617
-            }
618
-        }
619
-
620
-        /*
613
+			if ($this->getBoolean($root->getAttribute('colors'), false)) {
614
+				$result['colors'] = ResultPrinter::COLOR_AUTO;
615
+			} else {
616
+				$result['colors'] = ResultPrinter::COLOR_NEVER;
617
+			}
618
+		}
619
+
620
+		/*
621 621
          * Issue #657
622 622
          */
623
-        if ($root->hasAttribute('stderr')) {
624
-            $result['stderr'] = $this->getBoolean(
625
-                (string) $root->getAttribute('stderr'),
626
-                false
627
-            );
628
-        }
629
-
630
-        if ($root->hasAttribute('backupGlobals')) {
631
-            $result['backupGlobals'] = $this->getBoolean(
632
-                (string) $root->getAttribute('backupGlobals'),
633
-                false
634
-            );
635
-        }
636
-
637
-        if ($root->hasAttribute('backupStaticAttributes')) {
638
-            $result['backupStaticAttributes'] = $this->getBoolean(
639
-                (string) $root->getAttribute('backupStaticAttributes'),
640
-                false
641
-            );
642
-        }
643
-
644
-        if ($root->getAttribute('bootstrap')) {
645
-            $result['bootstrap'] = $this->toAbsolutePath(
646
-                (string) $root->getAttribute('bootstrap')
647
-            );
648
-        }
649
-
650
-        if ($root->hasAttribute('convertDeprecationsToExceptions')) {
651
-            $result['convertDeprecationsToExceptions'] = $this->getBoolean(
652
-                (string) $root->getAttribute('convertDeprecationsToExceptions'),
653
-                true
654
-            );
655
-        }
656
-
657
-        if ($root->hasAttribute('convertErrorsToExceptions')) {
658
-            $result['convertErrorsToExceptions'] = $this->getBoolean(
659
-                (string) $root->getAttribute('convertErrorsToExceptions'),
660
-                true
661
-            );
662
-        }
663
-
664
-        if ($root->hasAttribute('convertNoticesToExceptions')) {
665
-            $result['convertNoticesToExceptions'] = $this->getBoolean(
666
-                (string) $root->getAttribute('convertNoticesToExceptions'),
667
-                true
668
-            );
669
-        }
670
-
671
-        if ($root->hasAttribute('convertWarningsToExceptions')) {
672
-            $result['convertWarningsToExceptions'] = $this->getBoolean(
673
-                (string) $root->getAttribute('convertWarningsToExceptions'),
674
-                true
675
-            );
676
-        }
677
-
678
-        if ($root->hasAttribute('forceCoversAnnotation')) {
679
-            $result['forceCoversAnnotation'] = $this->getBoolean(
680
-                (string) $root->getAttribute('forceCoversAnnotation'),
681
-                false
682
-            );
683
-        }
684
-
685
-        if ($root->hasAttribute('disableCodeCoverageIgnore')) {
686
-            $result['disableCodeCoverageIgnore'] = $this->getBoolean(
687
-                (string) $root->getAttribute('disableCodeCoverageIgnore'),
688
-                false
689
-            );
690
-        }
691
-
692
-        if ($root->hasAttribute('processIsolation')) {
693
-            $result['processIsolation'] = $this->getBoolean(
694
-                (string) $root->getAttribute('processIsolation'),
695
-                false
696
-            );
697
-        }
698
-
699
-        if ($root->hasAttribute('stopOnError')) {
700
-            $result['stopOnError'] = $this->getBoolean(
701
-                (string) $root->getAttribute('stopOnError'),
702
-                false
703
-            );
704
-        }
705
-
706
-        if ($root->hasAttribute('stopOnFailure')) {
707
-            $result['stopOnFailure'] = $this->getBoolean(
708
-                (string) $root->getAttribute('stopOnFailure'),
709
-                false
710
-            );
711
-        }
712
-
713
-        if ($root->hasAttribute('stopOnWarning')) {
714
-            $result['stopOnWarning'] = $this->getBoolean(
715
-                (string) $root->getAttribute('stopOnWarning'),
716
-                false
717
-            );
718
-        }
719
-
720
-        if ($root->hasAttribute('stopOnIncomplete')) {
721
-            $result['stopOnIncomplete'] = $this->getBoolean(
722
-                (string) $root->getAttribute('stopOnIncomplete'),
723
-                false
724
-            );
725
-        }
726
-
727
-        if ($root->hasAttribute('stopOnRisky')) {
728
-            $result['stopOnRisky'] = $this->getBoolean(
729
-                (string) $root->getAttribute('stopOnRisky'),
730
-                false
731
-            );
732
-        }
733
-
734
-        if ($root->hasAttribute('stopOnSkipped')) {
735
-            $result['stopOnSkipped'] = $this->getBoolean(
736
-                (string) $root->getAttribute('stopOnSkipped'),
737
-                false
738
-            );
739
-        }
740
-
741
-        if ($root->hasAttribute('failOnWarning')) {
742
-            $result['failOnWarning'] = $this->getBoolean(
743
-                (string) $root->getAttribute('failOnWarning'),
744
-                false
745
-            );
746
-        }
747
-
748
-        if ($root->hasAttribute('failOnRisky')) {
749
-            $result['failOnRisky'] = $this->getBoolean(
750
-                (string) $root->getAttribute('failOnRisky'),
751
-                false
752
-            );
753
-        }
754
-
755
-        if ($root->hasAttribute('testSuiteLoaderClass')) {
756
-            $result['testSuiteLoaderClass'] = (string) $root->getAttribute(
757
-                'testSuiteLoaderClass'
758
-            );
759
-        }
760
-
761
-        if ($root->hasAttribute('defaultTestSuite')) {
762
-            $result['defaultTestSuite'] = (string) $root->getAttribute(
763
-                'defaultTestSuite'
764
-            );
765
-        }
766
-
767
-        if ($root->getAttribute('testSuiteLoaderFile')) {
768
-            $result['testSuiteLoaderFile'] = $this->toAbsolutePath(
769
-                (string) $root->getAttribute('testSuiteLoaderFile')
770
-            );
771
-        }
772
-
773
-        if ($root->hasAttribute('printerClass')) {
774
-            $result['printerClass'] = (string) $root->getAttribute(
775
-                'printerClass'
776
-            );
777
-        }
778
-
779
-        if ($root->getAttribute('printerFile')) {
780
-            $result['printerFile'] = $this->toAbsolutePath(
781
-                (string) $root->getAttribute('printerFile')
782
-            );
783
-        }
784
-
785
-        if ($root->hasAttribute('beStrictAboutChangesToGlobalState')) {
786
-            $result['beStrictAboutChangesToGlobalState'] = $this->getBoolean(
787
-                (string) $root->getAttribute('beStrictAboutChangesToGlobalState'),
788
-                false
789
-            );
790
-        }
791
-
792
-        if ($root->hasAttribute('beStrictAboutOutputDuringTests')) {
793
-            $result['disallowTestOutput'] = $this->getBoolean(
794
-                (string) $root->getAttribute('beStrictAboutOutputDuringTests'),
795
-                false
796
-            );
797
-        }
798
-
799
-        if ($root->hasAttribute('beStrictAboutResourceUsageDuringSmallTests')) {
800
-            $result['beStrictAboutResourceUsageDuringSmallTests'] = $this->getBoolean(
801
-                (string) $root->getAttribute('beStrictAboutResourceUsageDuringSmallTests'),
802
-                false
803
-            );
804
-        }
805
-
806
-        if ($root->hasAttribute('beStrictAboutTestsThatDoNotTestAnything')) {
807
-            $result['reportUselessTests'] = $this->getBoolean(
808
-                (string) $root->getAttribute('beStrictAboutTestsThatDoNotTestAnything'),
809
-                true
810
-            );
811
-        }
812
-
813
-        if ($root->hasAttribute('beStrictAboutTodoAnnotatedTests')) {
814
-            $result['disallowTodoAnnotatedTests'] = $this->getBoolean(
815
-                (string) $root->getAttribute('beStrictAboutTodoAnnotatedTests'),
816
-                false
817
-            );
818
-        }
819
-
820
-        if ($root->hasAttribute('beStrictAboutCoversAnnotation')) {
821
-            $result['strictCoverage'] = $this->getBoolean(
822
-                (string) $root->getAttribute('beStrictAboutCoversAnnotation'),
823
-                false
824
-            );
825
-        }
826
-
827
-        if ($root->hasAttribute('enforceTimeLimit')) {
828
-            $result['enforceTimeLimit'] = $this->getBoolean(
829
-                (string) $root->getAttribute('enforceTimeLimit'),
830
-                false
831
-            );
832
-        }
833
-
834
-        if ($root->hasAttribute('ignoreDeprecatedCodeUnitsFromCodeCoverage')) {
835
-            $result['ignoreDeprecatedCodeUnitsFromCodeCoverage'] = $this->getBoolean(
836
-                (string) $root->getAttribute('ignoreDeprecatedCodeUnitsFromCodeCoverage'),
837
-                false
838
-            );
839
-        }
840
-
841
-        if ($root->hasAttribute('timeoutForSmallTests')) {
842
-            $result['timeoutForSmallTests'] = $this->getInteger(
843
-                (string) $root->getAttribute('timeoutForSmallTests'),
844
-                1
845
-            );
846
-        }
847
-
848
-        if ($root->hasAttribute('timeoutForMediumTests')) {
849
-            $result['timeoutForMediumTests'] = $this->getInteger(
850
-                (string) $root->getAttribute('timeoutForMediumTests'),
851
-                10
852
-            );
853
-        }
854
-
855
-        if ($root->hasAttribute('timeoutForLargeTests')) {
856
-            $result['timeoutForLargeTests'] = $this->getInteger(
857
-                (string) $root->getAttribute('timeoutForLargeTests'),
858
-                60
859
-            );
860
-        }
861
-
862
-        if ($root->hasAttribute('reverseDefectList')) {
863
-            $result['reverseDefectList'] = $this->getBoolean(
864
-                (string) $root->getAttribute('reverseDefectList'),
865
-                false
866
-            );
867
-        }
868
-
869
-        if ($root->hasAttribute('verbose')) {
870
-            $result['verbose'] = $this->getBoolean(
871
-                (string) $root->getAttribute('verbose'),
872
-                false
873
-            );
874
-        }
875
-
876
-        if ($root->hasAttribute('registerMockObjectsFromTestArgumentsRecursively')) {
877
-            $result['registerMockObjectsFromTestArgumentsRecursively'] = $this->getBoolean(
878
-                (string) $root->getAttribute('registerMockObjectsFromTestArgumentsRecursively'),
879
-                false
880
-            );
881
-        }
882
-
883
-        if ($root->hasAttribute('extensionsDirectory')) {
884
-            $result['extensionsDirectory'] = $this->toAbsolutePath(
885
-                (string) $root->getAttribute(
886
-                    'extensionsDirectory'
887
-                )
888
-            );
889
-        }
890
-
891
-        return $result;
892
-    }
893
-
894
-    /**
895
-     * Returns the test suite configuration.
896
-     *
897
-     * @param string|null $testSuiteFilter
898
-     *
899
-     * @return TestSuite
900
-     */
901
-    public function getTestSuiteConfiguration($testSuiteFilter = null)
902
-    {
903
-        $testSuiteNodes = $this->xpath->query('testsuites/testsuite');
904
-
905
-        if ($testSuiteNodes->length == 0) {
906
-            $testSuiteNodes = $this->xpath->query('testsuite');
907
-        }
908
-
909
-        if ($testSuiteNodes->length == 1) {
910
-            return $this->getTestSuite($testSuiteNodes->item(0), $testSuiteFilter);
911
-        }
912
-
913
-        //if ($testSuiteNodes->length > 1) { there cannot be a negative number of Nodes
914
-        $suite = new TestSuite;
915
-
916
-        foreach ($testSuiteNodes as $testSuiteNode) {
917
-            $suite->addTestSuite(
918
-                $this->getTestSuite($testSuiteNode, $testSuiteFilter)
919
-            );
920
-        }
921
-
922
-        return $suite;
923
-    }
924
-
925
-    /**
926
-     * Returns the test suite names from the configuration.
927
-     *
928
-     * @return array
929
-     */
930
-    public function getTestSuiteNames()
931
-    {
932
-        $names = [];
933
-        $nodes = $this->xpath->query('*/testsuite');
934
-        foreach ($nodes as $node) {
935
-            $names[] = $node->getAttribute('name');
936
-        }
937
-
938
-        return $names;
939
-    }
940
-
941
-    /**
942
-     * @param DOMElement  $testSuiteNode
943
-     * @param string|null $testSuiteFilter
944
-     *
945
-     * @return TestSuite
946
-     */
947
-    protected function getTestSuite(DOMElement $testSuiteNode, $testSuiteFilter = null)
948
-    {
949
-        if ($testSuiteNode->hasAttribute('name')) {
950
-            $suite = new TestSuite(
951
-                (string) $testSuiteNode->getAttribute('name')
952
-            );
953
-        } else {
954
-            $suite = new TestSuite;
955
-        }
956
-
957
-        $exclude = [];
958
-
959
-        foreach ($testSuiteNode->getElementsByTagName('exclude') as $excludeNode) {
960
-            $excludeFile = (string) $excludeNode->textContent;
961
-            if ($excludeFile) {
962
-                $exclude[] = $this->toAbsolutePath($excludeFile);
963
-            }
964
-        }
965
-
966
-        $fileIteratorFacade = new File_Iterator_Facade;
967
-        $testSuiteFilter    = $testSuiteFilter ? \explode(self::TEST_SUITE_FILTER_SEPARATOR, $testSuiteFilter) : [];
968
-
969
-        foreach ($testSuiteNode->getElementsByTagName('directory') as $directoryNode) {
970
-            if (!empty($testSuiteFilter) && !\in_array($directoryNode->parentNode->getAttribute('name'), $testSuiteFilter)) {
971
-                continue;
972
-            }
973
-
974
-            $directory = (string) $directoryNode->textContent;
975
-
976
-            if (empty($directory)) {
977
-                continue;
978
-            }
979
-
980
-            if ($directoryNode->hasAttribute('phpVersion')) {
981
-                $phpVersion = (string) $directoryNode->getAttribute('phpVersion');
982
-            } else {
983
-                $phpVersion = PHP_VERSION;
984
-            }
985
-
986
-            if ($directoryNode->hasAttribute('phpVersionOperator')) {
987
-                $phpVersionOperator = (string) $directoryNode->getAttribute('phpVersionOperator');
988
-            } else {
989
-                $phpVersionOperator = '>=';
990
-            }
991
-
992
-            if (!\version_compare(PHP_VERSION, $phpVersion, $phpVersionOperator)) {
993
-                continue;
994
-            }
995
-
996
-            if ($directoryNode->hasAttribute('prefix')) {
997
-                $prefix = (string) $directoryNode->getAttribute('prefix');
998
-            } else {
999
-                $prefix = '';
1000
-            }
1001
-
1002
-            if ($directoryNode->hasAttribute('suffix')) {
1003
-                $suffix = (string) $directoryNode->getAttribute('suffix');
1004
-            } else {
1005
-                $suffix = 'Test.php';
1006
-            }
1007
-
1008
-            $files = $fileIteratorFacade->getFilesAsArray(
1009
-                $this->toAbsolutePath($directory),
1010
-                $suffix,
1011
-                $prefix,
1012
-                $exclude
1013
-            );
1014
-            $suite->addTestFiles($files);
1015
-        }
1016
-
1017
-        foreach ($testSuiteNode->getElementsByTagName('file') as $fileNode) {
1018
-            if (!empty($testSuiteFilter) && !\in_array($fileNode->parentNode->getAttribute('name'), $testSuiteFilter)) {
1019
-                continue;
1020
-            }
1021
-
1022
-            $file = (string) $fileNode->textContent;
1023
-
1024
-            if (empty($file)) {
1025
-                continue;
1026
-            }
1027
-
1028
-            // Get the absolute path to the file
1029
-            $file = $fileIteratorFacade->getFilesAsArray(
1030
-                $this->toAbsolutePath($file)
1031
-            );
1032
-
1033
-            if (!isset($file[0])) {
1034
-                continue;
1035
-            }
1036
-
1037
-            $file = $file[0];
1038
-
1039
-            if ($fileNode->hasAttribute('phpVersion')) {
1040
-                $phpVersion = (string) $fileNode->getAttribute('phpVersion');
1041
-            } else {
1042
-                $phpVersion = PHP_VERSION;
1043
-            }
1044
-
1045
-            if ($fileNode->hasAttribute('phpVersionOperator')) {
1046
-                $phpVersionOperator = (string) $fileNode->getAttribute('phpVersionOperator');
1047
-            } else {
1048
-                $phpVersionOperator = '>=';
1049
-            }
1050
-
1051
-            if (!\version_compare(PHP_VERSION, $phpVersion, $phpVersionOperator)) {
1052
-                continue;
1053
-            }
1054
-
1055
-            $suite->addTestFile($file);
1056
-        }
1057
-
1058
-        return $suite;
1059
-    }
1060
-
1061
-    /**
1062
-     * if $value is 'false' or 'true', this returns the value that $value represents.
1063
-     * Otherwise, returns $default, which may be a string in rare cases.
1064
-     * See PHPUnit\Util\ConfigurationTest::testPHPConfigurationIsReadCorrectly
1065
-     *
1066
-     * @param string      $value
1067
-     * @param string|bool $default
1068
-     *
1069
-     * @return string|bool
1070
-     */
1071
-    protected function getBoolean($value, $default)
1072
-    {
1073
-        if (\strtolower($value) == 'false') {
1074
-            return false;
1075
-        }
1076
-
1077
-        if (\strtolower($value) == 'true') {
1078
-            return true;
1079
-        }
1080
-
1081
-        return $default;
1082
-    }
1083
-
1084
-    /**
1085
-     * @param string $value
1086
-     * @param int    $default
1087
-     *
1088
-     * @return int
1089
-     */
1090
-    protected function getInteger($value, $default)
1091
-    {
1092
-        if (\is_numeric($value)) {
1093
-            return (int) $value;
1094
-        }
1095
-
1096
-        return $default;
1097
-    }
1098
-
1099
-    /**
1100
-     * @param string $query
1101
-     *
1102
-     * @return array
1103
-     */
1104
-    protected function readFilterDirectories($query)
1105
-    {
1106
-        $directories = [];
1107
-
1108
-        foreach ($this->xpath->query($query) as $directory) {
1109
-            $directoryPath = (string) $directory->textContent;
1110
-
1111
-            if (!$directoryPath) {
1112
-                continue;
1113
-            }
1114
-
1115
-            if ($directory->hasAttribute('prefix')) {
1116
-                $prefix = (string) $directory->getAttribute('prefix');
1117
-            } else {
1118
-                $prefix = '';
1119
-            }
1120
-
1121
-            if ($directory->hasAttribute('suffix')) {
1122
-                $suffix = (string) $directory->getAttribute('suffix');
1123
-            } else {
1124
-                $suffix = '.php';
1125
-            }
1126
-
1127
-            if ($directory->hasAttribute('group')) {
1128
-                $group = (string) $directory->getAttribute('group');
1129
-            } else {
1130
-                $group = 'DEFAULT';
1131
-            }
1132
-
1133
-            $directories[] = [
1134
-                'path'   => $this->toAbsolutePath($directoryPath),
1135
-                'prefix' => $prefix,
1136
-                'suffix' => $suffix,
1137
-                'group'  => $group
1138
-            ];
1139
-        }
1140
-
1141
-        return $directories;
1142
-    }
1143
-
1144
-    /**
1145
-     * @param string $query
1146
-     *
1147
-     * @return array
1148
-     */
1149
-    protected function readFilterFiles($query)
1150
-    {
1151
-        $files = [];
1152
-
1153
-        foreach ($this->xpath->query($query) as $file) {
1154
-            $filePath = (string) $file->textContent;
1155
-
1156
-            if ($filePath) {
1157
-                $files[] = $this->toAbsolutePath($filePath);
1158
-            }
1159
-        }
1160
-
1161
-        return $files;
1162
-    }
1163
-
1164
-    /**
1165
-     * @param string $path
1166
-     * @param bool   $useIncludePath
1167
-     *
1168
-     * @return string
1169
-     */
1170
-    protected function toAbsolutePath($path, $useIncludePath = false)
1171
-    {
1172
-        $path = \trim($path);
1173
-
1174
-        if ($path[0] === '/') {
1175
-            return $path;
1176
-        }
1177
-
1178
-        // Matches the following on Windows:
1179
-        //  - \\NetworkComputer\Path
1180
-        //  - \\.\D:
1181
-        //  - \\.\c:
1182
-        //  - C:\Windows
1183
-        //  - C:\windows
1184
-        //  - C:/windows
1185
-        //  - c:/windows
1186
-        if (\defined('PHP_WINDOWS_VERSION_BUILD') &&
1187
-            ($path[0] === '\\' || (\strlen($path) >= 3 && \preg_match('#^[A-Z]\:[/\\\]#i', \substr($path, 0, 3))))) {
1188
-            return $path;
1189
-        }
1190
-
1191
-        // Stream
1192
-        if (\strpos($path, '://') !== false) {
1193
-            return $path;
1194
-        }
1195
-
1196
-        $file = \dirname($this->filename) . DIRECTORY_SEPARATOR . $path;
1197
-
1198
-        if ($useIncludePath && !\file_exists($file)) {
1199
-            $includePathFile = \stream_resolve_include_path($path);
1200
-
1201
-            if ($includePathFile) {
1202
-                $file = $includePathFile;
1203
-            }
1204
-        }
1205
-
1206
-        return $file;
1207
-    }
623
+		if ($root->hasAttribute('stderr')) {
624
+			$result['stderr'] = $this->getBoolean(
625
+				(string) $root->getAttribute('stderr'),
626
+				false
627
+			);
628
+		}
629
+
630
+		if ($root->hasAttribute('backupGlobals')) {
631
+			$result['backupGlobals'] = $this->getBoolean(
632
+				(string) $root->getAttribute('backupGlobals'),
633
+				false
634
+			);
635
+		}
636
+
637
+		if ($root->hasAttribute('backupStaticAttributes')) {
638
+			$result['backupStaticAttributes'] = $this->getBoolean(
639
+				(string) $root->getAttribute('backupStaticAttributes'),
640
+				false
641
+			);
642
+		}
643
+
644
+		if ($root->getAttribute('bootstrap')) {
645
+			$result['bootstrap'] = $this->toAbsolutePath(
646
+				(string) $root->getAttribute('bootstrap')
647
+			);
648
+		}
649
+
650
+		if ($root->hasAttribute('convertDeprecationsToExceptions')) {
651
+			$result['convertDeprecationsToExceptions'] = $this->getBoolean(
652
+				(string) $root->getAttribute('convertDeprecationsToExceptions'),
653
+				true
654
+			);
655
+		}
656
+
657
+		if ($root->hasAttribute('convertErrorsToExceptions')) {
658
+			$result['convertErrorsToExceptions'] = $this->getBoolean(
659
+				(string) $root->getAttribute('convertErrorsToExceptions'),
660
+				true
661
+			);
662
+		}
663
+
664
+		if ($root->hasAttribute('convertNoticesToExceptions')) {
665
+			$result['convertNoticesToExceptions'] = $this->getBoolean(
666
+				(string) $root->getAttribute('convertNoticesToExceptions'),
667
+				true
668
+			);
669
+		}
670
+
671
+		if ($root->hasAttribute('convertWarningsToExceptions')) {
672
+			$result['convertWarningsToExceptions'] = $this->getBoolean(
673
+				(string) $root->getAttribute('convertWarningsToExceptions'),
674
+				true
675
+			);
676
+		}
677
+
678
+		if ($root->hasAttribute('forceCoversAnnotation')) {
679
+			$result['forceCoversAnnotation'] = $this->getBoolean(
680
+				(string) $root->getAttribute('forceCoversAnnotation'),
681
+				false
682
+			);
683
+		}
684
+
685
+		if ($root->hasAttribute('disableCodeCoverageIgnore')) {
686
+			$result['disableCodeCoverageIgnore'] = $this->getBoolean(
687
+				(string) $root->getAttribute('disableCodeCoverageIgnore'),
688
+				false
689
+			);
690
+		}
691
+
692
+		if ($root->hasAttribute('processIsolation')) {
693
+			$result['processIsolation'] = $this->getBoolean(
694
+				(string) $root->getAttribute('processIsolation'),
695
+				false
696
+			);
697
+		}
698
+
699
+		if ($root->hasAttribute('stopOnError')) {
700
+			$result['stopOnError'] = $this->getBoolean(
701
+				(string) $root->getAttribute('stopOnError'),
702
+				false
703
+			);
704
+		}
705
+
706
+		if ($root->hasAttribute('stopOnFailure')) {
707
+			$result['stopOnFailure'] = $this->getBoolean(
708
+				(string) $root->getAttribute('stopOnFailure'),
709
+				false
710
+			);
711
+		}
712
+
713
+		if ($root->hasAttribute('stopOnWarning')) {
714
+			$result['stopOnWarning'] = $this->getBoolean(
715
+				(string) $root->getAttribute('stopOnWarning'),
716
+				false
717
+			);
718
+		}
719
+
720
+		if ($root->hasAttribute('stopOnIncomplete')) {
721
+			$result['stopOnIncomplete'] = $this->getBoolean(
722
+				(string) $root->getAttribute('stopOnIncomplete'),
723
+				false
724
+			);
725
+		}
726
+
727
+		if ($root->hasAttribute('stopOnRisky')) {
728
+			$result['stopOnRisky'] = $this->getBoolean(
729
+				(string) $root->getAttribute('stopOnRisky'),
730
+				false
731
+			);
732
+		}
733
+
734
+		if ($root->hasAttribute('stopOnSkipped')) {
735
+			$result['stopOnSkipped'] = $this->getBoolean(
736
+				(string) $root->getAttribute('stopOnSkipped'),
737
+				false
738
+			);
739
+		}
740
+
741
+		if ($root->hasAttribute('failOnWarning')) {
742
+			$result['failOnWarning'] = $this->getBoolean(
743
+				(string) $root->getAttribute('failOnWarning'),
744
+				false
745
+			);
746
+		}
747
+
748
+		if ($root->hasAttribute('failOnRisky')) {
749
+			$result['failOnRisky'] = $this->getBoolean(
750
+				(string) $root->getAttribute('failOnRisky'),
751
+				false
752
+			);
753
+		}
754
+
755
+		if ($root->hasAttribute('testSuiteLoaderClass')) {
756
+			$result['testSuiteLoaderClass'] = (string) $root->getAttribute(
757
+				'testSuiteLoaderClass'
758
+			);
759
+		}
760
+
761
+		if ($root->hasAttribute('defaultTestSuite')) {
762
+			$result['defaultTestSuite'] = (string) $root->getAttribute(
763
+				'defaultTestSuite'
764
+			);
765
+		}
766
+
767
+		if ($root->getAttribute('testSuiteLoaderFile')) {
768
+			$result['testSuiteLoaderFile'] = $this->toAbsolutePath(
769
+				(string) $root->getAttribute('testSuiteLoaderFile')
770
+			);
771
+		}
772
+
773
+		if ($root->hasAttribute('printerClass')) {
774
+			$result['printerClass'] = (string) $root->getAttribute(
775
+				'printerClass'
776
+			);
777
+		}
778
+
779
+		if ($root->getAttribute('printerFile')) {
780
+			$result['printerFile'] = $this->toAbsolutePath(
781
+				(string) $root->getAttribute('printerFile')
782
+			);
783
+		}
784
+
785
+		if ($root->hasAttribute('beStrictAboutChangesToGlobalState')) {
786
+			$result['beStrictAboutChangesToGlobalState'] = $this->getBoolean(
787
+				(string) $root->getAttribute('beStrictAboutChangesToGlobalState'),
788
+				false
789
+			);
790
+		}
791
+
792
+		if ($root->hasAttribute('beStrictAboutOutputDuringTests')) {
793
+			$result['disallowTestOutput'] = $this->getBoolean(
794
+				(string) $root->getAttribute('beStrictAboutOutputDuringTests'),
795
+				false
796
+			);
797
+		}
798
+
799
+		if ($root->hasAttribute('beStrictAboutResourceUsageDuringSmallTests')) {
800
+			$result['beStrictAboutResourceUsageDuringSmallTests'] = $this->getBoolean(
801
+				(string) $root->getAttribute('beStrictAboutResourceUsageDuringSmallTests'),
802
+				false
803
+			);
804
+		}
805
+
806
+		if ($root->hasAttribute('beStrictAboutTestsThatDoNotTestAnything')) {
807
+			$result['reportUselessTests'] = $this->getBoolean(
808
+				(string) $root->getAttribute('beStrictAboutTestsThatDoNotTestAnything'),
809
+				true
810
+			);
811
+		}
812
+
813
+		if ($root->hasAttribute('beStrictAboutTodoAnnotatedTests')) {
814
+			$result['disallowTodoAnnotatedTests'] = $this->getBoolean(
815
+				(string) $root->getAttribute('beStrictAboutTodoAnnotatedTests'),
816
+				false
817
+			);
818
+		}
819
+
820
+		if ($root->hasAttribute('beStrictAboutCoversAnnotation')) {
821
+			$result['strictCoverage'] = $this->getBoolean(
822
+				(string) $root->getAttribute('beStrictAboutCoversAnnotation'),
823
+				false
824
+			);
825
+		}
826
+
827
+		if ($root->hasAttribute('enforceTimeLimit')) {
828
+			$result['enforceTimeLimit'] = $this->getBoolean(
829
+				(string) $root->getAttribute('enforceTimeLimit'),
830
+				false
831
+			);
832
+		}
833
+
834
+		if ($root->hasAttribute('ignoreDeprecatedCodeUnitsFromCodeCoverage')) {
835
+			$result['ignoreDeprecatedCodeUnitsFromCodeCoverage'] = $this->getBoolean(
836
+				(string) $root->getAttribute('ignoreDeprecatedCodeUnitsFromCodeCoverage'),
837
+				false
838
+			);
839
+		}
840
+
841
+		if ($root->hasAttribute('timeoutForSmallTests')) {
842
+			$result['timeoutForSmallTests'] = $this->getInteger(
843
+				(string) $root->getAttribute('timeoutForSmallTests'),
844
+				1
845
+			);
846
+		}
847
+
848
+		if ($root->hasAttribute('timeoutForMediumTests')) {
849
+			$result['timeoutForMediumTests'] = $this->getInteger(
850
+				(string) $root->getAttribute('timeoutForMediumTests'),
851
+				10
852
+			);
853
+		}
854
+
855
+		if ($root->hasAttribute('timeoutForLargeTests')) {
856
+			$result['timeoutForLargeTests'] = $this->getInteger(
857
+				(string) $root->getAttribute('timeoutForLargeTests'),
858
+				60
859
+			);
860
+		}
861
+
862
+		if ($root->hasAttribute('reverseDefectList')) {
863
+			$result['reverseDefectList'] = $this->getBoolean(
864
+				(string) $root->getAttribute('reverseDefectList'),
865
+				false
866
+			);
867
+		}
868
+
869
+		if ($root->hasAttribute('verbose')) {
870
+			$result['verbose'] = $this->getBoolean(
871
+				(string) $root->getAttribute('verbose'),
872
+				false
873
+			);
874
+		}
875
+
876
+		if ($root->hasAttribute('registerMockObjectsFromTestArgumentsRecursively')) {
877
+			$result['registerMockObjectsFromTestArgumentsRecursively'] = $this->getBoolean(
878
+				(string) $root->getAttribute('registerMockObjectsFromTestArgumentsRecursively'),
879
+				false
880
+			);
881
+		}
882
+
883
+		if ($root->hasAttribute('extensionsDirectory')) {
884
+			$result['extensionsDirectory'] = $this->toAbsolutePath(
885
+				(string) $root->getAttribute(
886
+					'extensionsDirectory'
887
+				)
888
+			);
889
+		}
890
+
891
+		return $result;
892
+	}
893
+
894
+	/**
895
+	 * Returns the test suite configuration.
896
+	 *
897
+	 * @param string|null $testSuiteFilter
898
+	 *
899
+	 * @return TestSuite
900
+	 */
901
+	public function getTestSuiteConfiguration($testSuiteFilter = null)
902
+	{
903
+		$testSuiteNodes = $this->xpath->query('testsuites/testsuite');
904
+
905
+		if ($testSuiteNodes->length == 0) {
906
+			$testSuiteNodes = $this->xpath->query('testsuite');
907
+		}
908
+
909
+		if ($testSuiteNodes->length == 1) {
910
+			return $this->getTestSuite($testSuiteNodes->item(0), $testSuiteFilter);
911
+		}
912
+
913
+		//if ($testSuiteNodes->length > 1) { there cannot be a negative number of Nodes
914
+		$suite = new TestSuite;
915
+
916
+		foreach ($testSuiteNodes as $testSuiteNode) {
917
+			$suite->addTestSuite(
918
+				$this->getTestSuite($testSuiteNode, $testSuiteFilter)
919
+			);
920
+		}
921
+
922
+		return $suite;
923
+	}
924
+
925
+	/**
926
+	 * Returns the test suite names from the configuration.
927
+	 *
928
+	 * @return array
929
+	 */
930
+	public function getTestSuiteNames()
931
+	{
932
+		$names = [];
933
+		$nodes = $this->xpath->query('*/testsuite');
934
+		foreach ($nodes as $node) {
935
+			$names[] = $node->getAttribute('name');
936
+		}
937
+
938
+		return $names;
939
+	}
940
+
941
+	/**
942
+	 * @param DOMElement  $testSuiteNode
943
+	 * @param string|null $testSuiteFilter
944
+	 *
945
+	 * @return TestSuite
946
+	 */
947
+	protected function getTestSuite(DOMElement $testSuiteNode, $testSuiteFilter = null)
948
+	{
949
+		if ($testSuiteNode->hasAttribute('name')) {
950
+			$suite = new TestSuite(
951
+				(string) $testSuiteNode->getAttribute('name')
952
+			);
953
+		} else {
954
+			$suite = new TestSuite;
955
+		}
956
+
957
+		$exclude = [];
958
+
959
+		foreach ($testSuiteNode->getElementsByTagName('exclude') as $excludeNode) {
960
+			$excludeFile = (string) $excludeNode->textContent;
961
+			if ($excludeFile) {
962
+				$exclude[] = $this->toAbsolutePath($excludeFile);
963
+			}
964
+		}
965
+
966
+		$fileIteratorFacade = new File_Iterator_Facade;
967
+		$testSuiteFilter    = $testSuiteFilter ? \explode(self::TEST_SUITE_FILTER_SEPARATOR, $testSuiteFilter) : [];
968
+
969
+		foreach ($testSuiteNode->getElementsByTagName('directory') as $directoryNode) {
970
+			if (!empty($testSuiteFilter) && !\in_array($directoryNode->parentNode->getAttribute('name'), $testSuiteFilter)) {
971
+				continue;
972
+			}
973
+
974
+			$directory = (string) $directoryNode->textContent;
975
+
976
+			if (empty($directory)) {
977
+				continue;
978
+			}
979
+
980
+			if ($directoryNode->hasAttribute('phpVersion')) {
981
+				$phpVersion = (string) $directoryNode->getAttribute('phpVersion');
982
+			} else {
983
+				$phpVersion = PHP_VERSION;
984
+			}
985
+
986
+			if ($directoryNode->hasAttribute('phpVersionOperator')) {
987
+				$phpVersionOperator = (string) $directoryNode->getAttribute('phpVersionOperator');
988
+			} else {
989
+				$phpVersionOperator = '>=';
990
+			}
991
+
992
+			if (!\version_compare(PHP_VERSION, $phpVersion, $phpVersionOperator)) {
993
+				continue;
994
+			}
995
+
996
+			if ($directoryNode->hasAttribute('prefix')) {
997
+				$prefix = (string) $directoryNode->getAttribute('prefix');
998
+			} else {
999
+				$prefix = '';
1000
+			}
1001
+
1002
+			if ($directoryNode->hasAttribute('suffix')) {
1003
+				$suffix = (string) $directoryNode->getAttribute('suffix');
1004
+			} else {
1005
+				$suffix = 'Test.php';
1006
+			}
1007
+
1008
+			$files = $fileIteratorFacade->getFilesAsArray(
1009
+				$this->toAbsolutePath($directory),
1010
+				$suffix,
1011
+				$prefix,
1012
+				$exclude
1013
+			);
1014
+			$suite->addTestFiles($files);
1015
+		}
1016
+
1017
+		foreach ($testSuiteNode->getElementsByTagName('file') as $fileNode) {
1018
+			if (!empty($testSuiteFilter) && !\in_array($fileNode->parentNode->getAttribute('name'), $testSuiteFilter)) {
1019
+				continue;
1020
+			}
1021
+
1022
+			$file = (string) $fileNode->textContent;
1023
+
1024
+			if (empty($file)) {
1025
+				continue;
1026
+			}
1027
+
1028
+			// Get the absolute path to the file
1029
+			$file = $fileIteratorFacade->getFilesAsArray(
1030
+				$this->toAbsolutePath($file)
1031
+			);
1032
+
1033
+			if (!isset($file[0])) {
1034
+				continue;
1035
+			}
1036
+
1037
+			$file = $file[0];
1038
+
1039
+			if ($fileNode->hasAttribute('phpVersion')) {
1040
+				$phpVersion = (string) $fileNode->getAttribute('phpVersion');
1041
+			} else {
1042
+				$phpVersion = PHP_VERSION;
1043
+			}
1044
+
1045
+			if ($fileNode->hasAttribute('phpVersionOperator')) {
1046
+				$phpVersionOperator = (string) $fileNode->getAttribute('phpVersionOperator');
1047
+			} else {
1048
+				$phpVersionOperator = '>=';
1049
+			}
1050
+
1051
+			if (!\version_compare(PHP_VERSION, $phpVersion, $phpVersionOperator)) {
1052
+				continue;
1053
+			}
1054
+
1055
+			$suite->addTestFile($file);
1056
+		}
1057
+
1058
+		return $suite;
1059
+	}
1060
+
1061
+	/**
1062
+	 * if $value is 'false' or 'true', this returns the value that $value represents.
1063
+	 * Otherwise, returns $default, which may be a string in rare cases.
1064
+	 * See PHPUnit\Util\ConfigurationTest::testPHPConfigurationIsReadCorrectly
1065
+	 *
1066
+	 * @param string      $value
1067
+	 * @param string|bool $default
1068
+	 *
1069
+	 * @return string|bool
1070
+	 */
1071
+	protected function getBoolean($value, $default)
1072
+	{
1073
+		if (\strtolower($value) == 'false') {
1074
+			return false;
1075
+		}
1076
+
1077
+		if (\strtolower($value) == 'true') {
1078
+			return true;
1079
+		}
1080
+
1081
+		return $default;
1082
+	}
1083
+
1084
+	/**
1085
+	 * @param string $value
1086
+	 * @param int    $default
1087
+	 *
1088
+	 * @return int
1089
+	 */
1090
+	protected function getInteger($value, $default)
1091
+	{
1092
+		if (\is_numeric($value)) {
1093
+			return (int) $value;
1094
+		}
1095
+
1096
+		return $default;
1097
+	}
1098
+
1099
+	/**
1100
+	 * @param string $query
1101
+	 *
1102
+	 * @return array
1103
+	 */
1104
+	protected function readFilterDirectories($query)
1105
+	{
1106
+		$directories = [];
1107
+
1108
+		foreach ($this->xpath->query($query) as $directory) {
1109
+			$directoryPath = (string) $directory->textContent;
1110
+
1111
+			if (!$directoryPath) {
1112
+				continue;
1113
+			}
1114
+
1115
+			if ($directory->hasAttribute('prefix')) {
1116
+				$prefix = (string) $directory->getAttribute('prefix');
1117
+			} else {
1118
+				$prefix = '';
1119
+			}
1120
+
1121
+			if ($directory->hasAttribute('suffix')) {
1122
+				$suffix = (string) $directory->getAttribute('suffix');
1123
+			} else {
1124
+				$suffix = '.php';
1125
+			}
1126
+
1127
+			if ($directory->hasAttribute('group')) {
1128
+				$group = (string) $directory->getAttribute('group');
1129
+			} else {
1130
+				$group = 'DEFAULT';
1131
+			}
1132
+
1133
+			$directories[] = [
1134
+				'path'   => $this->toAbsolutePath($directoryPath),
1135
+				'prefix' => $prefix,
1136
+				'suffix' => $suffix,
1137
+				'group'  => $group
1138
+			];
1139
+		}
1140
+
1141
+		return $directories;
1142
+	}
1143
+
1144
+	/**
1145
+	 * @param string $query
1146
+	 *
1147
+	 * @return array
1148
+	 */
1149
+	protected function readFilterFiles($query)
1150
+	{
1151
+		$files = [];
1152
+
1153
+		foreach ($this->xpath->query($query) as $file) {
1154
+			$filePath = (string) $file->textContent;
1155
+
1156
+			if ($filePath) {
1157
+				$files[] = $this->toAbsolutePath($filePath);
1158
+			}
1159
+		}
1160
+
1161
+		return $files;
1162
+	}
1163
+
1164
+	/**
1165
+	 * @param string $path
1166
+	 * @param bool   $useIncludePath
1167
+	 *
1168
+	 * @return string
1169
+	 */
1170
+	protected function toAbsolutePath($path, $useIncludePath = false)
1171
+	{
1172
+		$path = \trim($path);
1173
+
1174
+		if ($path[0] === '/') {
1175
+			return $path;
1176
+		}
1177
+
1178
+		// Matches the following on Windows:
1179
+		//  - \\NetworkComputer\Path
1180
+		//  - \\.\D:
1181
+		//  - \\.\c:
1182
+		//  - C:\Windows
1183
+		//  - C:\windows
1184
+		//  - C:/windows
1185
+		//  - c:/windows
1186
+		if (\defined('PHP_WINDOWS_VERSION_BUILD') &&
1187
+			($path[0] === '\\' || (\strlen($path) >= 3 && \preg_match('#^[A-Z]\:[/\\\]#i', \substr($path, 0, 3))))) {
1188
+			return $path;
1189
+		}
1190
+
1191
+		// Stream
1192
+		if (\strpos($path, '://') !== false) {
1193
+			return $path;
1194
+		}
1195
+
1196
+		$file = \dirname($this->filename) . DIRECTORY_SEPARATOR . $path;
1197
+
1198
+		if ($useIncludePath && !\file_exists($file)) {
1199
+			$includePathFile = \stream_resolve_include_path($path);
1200
+
1201
+			if ($includePathFile) {
1202
+				$file = $includePathFile;
1203
+			}
1204
+		}
1205
+
1206
+		return $file;
1207
+	}
1208 1208
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
             'exclude' => []
317 317
         ];
318 318
 
319
-        foreach ($this->xpath->query($root . '/include/group') as $group) {
319
+        foreach ($this->xpath->query($root.'/include/group') as $group) {
320 320
             $groups['include'][] = (string) $group->textContent;
321 321
         }
322 322
 
323
-        foreach ($this->xpath->query($root . '/exclude/group') as $group) {
323
+        foreach ($this->xpath->query($root.'/exclude/group') as $group) {
324 324
             $groups['exclude'][] = (string) $group->textContent;
325 325
         }
326 326
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         }
478 478
 
479 479
         foreach (['var', 'env', 'post', 'get', 'cookie', 'server', 'files', 'request'] as $array) {
480
-            foreach ($this->xpath->query('php/' . $array) as $var) {
480
+            foreach ($this->xpath->query('php/'.$array) as $var) {
481 481
                 $name     = (string) $var->getAttribute('name');
482 482
                 $value    = (string) $var->getAttribute('value');
483 483
                 $verbatim = false;
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
         if (!empty($configuration['include_path'])) {
515 515
             \ini_set(
516 516
                 'include_path',
517
-                \implode(PATH_SEPARATOR, $configuration['include_path']) .
518
-                PATH_SEPARATOR .
517
+                \implode(PATH_SEPARATOR, $configuration['include_path']).
518
+                PATH_SEPARATOR.
519 519
                 \ini_get('include_path')
520 520
             );
521 521
         }
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
                     break;
553 553
 
554 554
                 default:
555
-                    $target = &$GLOBALS['_' . \strtoupper($array)];
555
+                    $target = &$GLOBALS['_'.\strtoupper($array)];
556 556
 
557 557
                     break;
558 558
             }
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
             return $path;
1194 1194
         }
1195 1195
 
1196
-        $file = \dirname($this->filename) . DIRECTORY_SEPARATOR . $path;
1196
+        $file = \dirname($this->filename).DIRECTORY_SEPARATOR.$path;
1197 1197
 
1198 1198
         if ($useIncludePath && !\file_exists($file)) {
1199 1199
             $includePathFile = \stream_resolve_include_path($path);
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Util/XmlTestListRenderer.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -16,67 +16,67 @@
 block discarded – undo
16 16
 
17 17
 class XmlTestListRenderer
18 18
 {
19
-    public function render(TestSuite $suite): string
20
-    {
21
-        $writer = new \XmlWriter;
22
-
23
-        $writer->openMemory();
24
-        $writer->setIndent(true);
25
-        $writer->startDocument();
26
-        $writer->startElement('tests');
27
-
28
-        $currentTestCase = null;
29
-
30
-        foreach (new \RecursiveIteratorIterator($suite->getIterator()) as $test) {
31
-            if ($test instanceof TestCase) {
32
-                if (\get_class($test) !== $currentTestCase) {
33
-                    if ($currentTestCase !== null) {
34
-                        $writer->endElement();
35
-                    }
36
-
37
-                    $writer->startElement('testCaseClass');
38
-                    $writer->writeAttribute('name', \get_class($test));
39
-
40
-                    $currentTestCase = \get_class($test);
41
-                }
42
-
43
-                $writer->startElement('testCaseMethod');
44
-                $writer->writeAttribute('name', $test->getName(false));
45
-                $writer->writeAttribute('groups', \implode(',', $test->getGroups()));
46
-
47
-                if (!empty($test->getDataSetAsString(false))) {
48
-                    $writer->writeAttribute(
49
-                        'dataSet',
50
-                        \str_replace(
51
-                            ' with data set ',
52
-                            '',
53
-                            $test->getDataSetAsString(false)
54
-                        )
55
-                    );
56
-                }
57
-
58
-                $writer->endElement();
59
-            } elseif ($test instanceof PhptTestCase) {
60
-                if ($currentTestCase !== null) {
61
-                    $writer->endElement();
62
-
63
-                    $currentTestCase = null;
64
-                }
65
-
66
-                $writer->startElement('phptFile');
67
-                $writer->writeAttribute('path', $test->getName());
68
-                $writer->endElement();
69
-            } else {
70
-                continue;
71
-            }
72
-        }
73
-
74
-        if ($currentTestCase !== null) {
75
-            $writer->endElement();
76
-        }
77
-
78
-        $writer->endElement();
79
-
80
-        return $writer->outputMemory();
81
-    }
19
+	public function render(TestSuite $suite): string
20
+	{
21
+		$writer = new \XmlWriter;
22
+
23
+		$writer->openMemory();
24
+		$writer->setIndent(true);
25
+		$writer->startDocument();
26
+		$writer->startElement('tests');
27
+
28
+		$currentTestCase = null;
29
+
30
+		foreach (new \RecursiveIteratorIterator($suite->getIterator()) as $test) {
31
+			if ($test instanceof TestCase) {
32
+				if (\get_class($test) !== $currentTestCase) {
33
+					if ($currentTestCase !== null) {
34
+						$writer->endElement();
35
+					}
36
+
37
+					$writer->startElement('testCaseClass');
38
+					$writer->writeAttribute('name', \get_class($test));
39
+
40
+					$currentTestCase = \get_class($test);
41
+				}
42
+
43
+				$writer->startElement('testCaseMethod');
44
+				$writer->writeAttribute('name', $test->getName(false));
45
+				$writer->writeAttribute('groups', \implode(',', $test->getGroups()));
46
+
47
+				if (!empty($test->getDataSetAsString(false))) {
48
+					$writer->writeAttribute(
49
+						'dataSet',
50
+						\str_replace(
51
+							' with data set ',
52
+							'',
53
+							$test->getDataSetAsString(false)
54
+						)
55
+					);
56
+				}
57
+
58
+				$writer->endElement();
59
+			} elseif ($test instanceof PhptTestCase) {
60
+				if ($currentTestCase !== null) {
61
+					$writer->endElement();
62
+
63
+					$currentTestCase = null;
64
+				}
65
+
66
+				$writer->startElement('phptFile');
67
+				$writer->writeAttribute('path', $test->getName());
68
+				$writer->endElement();
69
+			} else {
70
+				continue;
71
+			}
72
+		}
73
+
74
+		if ($currentTestCase !== null) {
75
+			$writer->endElement();
76
+		}
77
+
78
+		$writer->endElement();
79
+
80
+		return $writer->outputMemory();
81
+	}
82 82
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 /*
3 3
  * This file is part of PHPUnit.
4 4
  *
Please login to merge, or discard this patch.