Completed
Push — master ( 52755b...6c4366 )
by smiley
02:13
created
vendor/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
 
12 12
 class IncludeGroupFilterIterator extends GroupFilterIterator
13 13
 {
14
-    /**
15
-     * @param string $hash
16
-     *
17
-     * @return bool
18
-     */
19
-    protected function doAccept($hash)
20
-    {
21
-        return \in_array($hash, $this->groupTests);
22
-    }
14
+	/**
15
+	 * @param string $hash
16
+	 *
17
+	 * @return bool
18
+	 */
19
+	protected function doAccept($hash)
20
+	{
21
+		return \in_array($hash, $this->groupTests);
22
+	}
23 23
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -17,108 +17,108 @@
 block discarded – undo
17 17
 
18 18
 class NameFilterIterator extends RecursiveFilterIterator
19 19
 {
20
-    /**
21
-     * @var string
22
-     */
23
-    protected $filter;
20
+	/**
21
+	 * @var string
22
+	 */
23
+	protected $filter;
24 24
 
25
-    /**
26
-     * @var int
27
-     */
28
-    protected $filterMin;
29
-    /**
30
-     * @var int
31
-     */
32
-    protected $filterMax;
25
+	/**
26
+	 * @var int
27
+	 */
28
+	protected $filterMin;
29
+	/**
30
+	 * @var int
31
+	 */
32
+	protected $filterMax;
33 33
 
34
-    /**
35
-     * @param RecursiveIterator $iterator
36
-     * @param string            $filter
37
-     */
38
-    public function __construct(RecursiveIterator $iterator, $filter)
39
-    {
40
-        parent::__construct($iterator);
41
-        $this->setFilter($filter);
42
-    }
34
+	/**
35
+	 * @param RecursiveIterator $iterator
36
+	 * @param string            $filter
37
+	 */
38
+	public function __construct(RecursiveIterator $iterator, $filter)
39
+	{
40
+		parent::__construct($iterator);
41
+		$this->setFilter($filter);
42
+	}
43 43
 
44
-    /**
45
-     * @param string $filter
46
-     */
47
-    protected function setFilter($filter)
48
-    {
49
-        if (RegularExpression::safeMatch($filter, '') === false) {
50
-            // Handles:
51
-            //  * testAssertEqualsSucceeds#4
52
-            //  * testAssertEqualsSucceeds#4-8
53
-            if (\preg_match('/^(.*?)#(\d+)(?:-(\d+))?$/', $filter, $matches)) {
54
-                if (isset($matches[3]) && $matches[2] < $matches[3]) {
55
-                    $filter = \sprintf(
56
-                        '%s.*with data set #(\d+)$',
57
-                        $matches[1]
58
-                    );
44
+	/**
45
+	 * @param string $filter
46
+	 */
47
+	protected function setFilter($filter)
48
+	{
49
+		if (RegularExpression::safeMatch($filter, '') === false) {
50
+			// Handles:
51
+			//  * testAssertEqualsSucceeds#4
52
+			//  * testAssertEqualsSucceeds#4-8
53
+			if (\preg_match('/^(.*?)#(\d+)(?:-(\d+))?$/', $filter, $matches)) {
54
+				if (isset($matches[3]) && $matches[2] < $matches[3]) {
55
+					$filter = \sprintf(
56
+						'%s.*with data set #(\d+)$',
57
+						$matches[1]
58
+					);
59 59
 
60
-                    $this->filterMin = $matches[2];
61
-                    $this->filterMax = $matches[3];
62
-                } else {
63
-                    $filter = \sprintf(
64
-                        '%s.*with data set #%s$',
65
-                        $matches[1],
66
-                        $matches[2]
67
-                    );
68
-                }
69
-            } // Handles:
70
-            //  * testDetermineJsonError@JSON_ERROR_NONE
71
-            //  * testDetermineJsonError@JSON.*
72
-            elseif (\preg_match('/^(.*?)@(.+)$/', $filter, $matches)) {
73
-                $filter = \sprintf(
74
-                    '%s.*with data set "%s"$',
75
-                    $matches[1],
76
-                    $matches[2]
77
-                );
78
-            }
60
+					$this->filterMin = $matches[2];
61
+					$this->filterMax = $matches[3];
62
+				} else {
63
+					$filter = \sprintf(
64
+						'%s.*with data set #%s$',
65
+						$matches[1],
66
+						$matches[2]
67
+					);
68
+				}
69
+			} // Handles:
70
+			//  * testDetermineJsonError@JSON_ERROR_NONE
71
+			//  * testDetermineJsonError@JSON.*
72
+			elseif (\preg_match('/^(.*?)@(.+)$/', $filter, $matches)) {
73
+				$filter = \sprintf(
74
+					'%s.*with data set "%s"$',
75
+					$matches[1],
76
+					$matches[2]
77
+				);
78
+			}
79 79
 
80
-            // Escape delimiters in regular expression. Do NOT use preg_quote,
81
-            // to keep magic characters.
82
-            $filter = \sprintf('/%s/', \str_replace(
83
-                '/',
84
-                '\\/',
85
-                $filter
86
-            ));
87
-        }
80
+			// Escape delimiters in regular expression. Do NOT use preg_quote,
81
+			// to keep magic characters.
82
+			$filter = \sprintf('/%s/', \str_replace(
83
+				'/',
84
+				'\\/',
85
+				$filter
86
+			));
87
+		}
88 88
 
89
-        $this->filter = $filter;
90
-    }
89
+		$this->filter = $filter;
90
+	}
91 91
 
92
-    /**
93
-     * @return bool
94
-     */
95
-    public function accept()
96
-    {
97
-        $test = $this->getInnerIterator()->current();
92
+	/**
93
+	 * @return bool
94
+	 */
95
+	public function accept()
96
+	{
97
+		$test = $this->getInnerIterator()->current();
98 98
 
99
-        if ($test instanceof TestSuite) {
100
-            return true;
101
-        }
99
+		if ($test instanceof TestSuite) {
100
+			return true;
101
+		}
102 102
 
103
-        $tmp = \PHPUnit\Util\Test::describe($test, false);
103
+		$tmp = \PHPUnit\Util\Test::describe($test, false);
104 104
 
105
-        if ($test instanceof WarningTestCase) {
106
-            $name = $test->getMessage();
107
-        } else {
108
-            if ($tmp[0] != '') {
109
-                $name = \implode('::', $tmp);
110
-            } else {
111
-                $name = $tmp[1];
112
-            }
113
-        }
105
+		if ($test instanceof WarningTestCase) {
106
+			$name = $test->getMessage();
107
+		} else {
108
+			if ($tmp[0] != '') {
109
+				$name = \implode('::', $tmp);
110
+			} else {
111
+				$name = $tmp[1];
112
+			}
113
+		}
114 114
 
115
-        $accepted = @\preg_match($this->filter, $name, $matches);
115
+		$accepted = @\preg_match($this->filter, $name, $matches);
116 116
 
117
-        if ($accepted && isset($this->filterMax)) {
118
-            $set      = \end($matches);
119
-            $accepted = $set >= $this->filterMin && $set <= $this->filterMax;
120
-        }
117
+		if ($accepted && isset($this->filterMax)) {
118
+			$set      = \end($matches);
119
+			$accepted = $set >= $this->filterMin && $set <= $this->filterMax;
120
+		}
121 121
 
122
-        return $accepted;
123
-    }
122
+		return $accepted;
123
+	}
124 124
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
 
12 12
 class ExcludeGroupFilterIterator extends GroupFilterIterator
13 13
 {
14
-    /**
15
-     * @param string $hash
16
-     *
17
-     * @return bool
18
-     */
19
-    protected function doAccept($hash)
20
-    {
21
-        return !\in_array($hash, $this->groupTests);
22
-    }
14
+	/**
15
+	 * @param string $hash
16
+	 *
17
+	 * @return bool
18
+	 */
19
+	protected function doAccept($hash)
20
+	{
21
+		return !\in_array($hash, $this->groupTests);
22
+	}
23 23
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Runner/PhptTestCase.php 1 patch
Indentation   +426 added lines, -426 removed lines patch added patch discarded remove patch
@@ -26,430 +26,430 @@
 block discarded – undo
26 26
  */
27 27
 class PhptTestCase implements Test, SelfDescribing
28 28
 {
29
-    /**
30
-     * @var string
31
-     */
32
-    private $filename;
33
-
34
-    /**
35
-     * @var AbstractPhpProcess
36
-     */
37
-    private $phpUtil;
38
-
39
-    /**
40
-     * @var array
41
-     */
42
-    private $settings = [
43
-        'allow_url_fopen=1',
44
-        'auto_append_file=',
45
-        'auto_prepend_file=',
46
-        'disable_functions=',
47
-        'display_errors=1',
48
-        'docref_root=',
49
-        'docref_ext=.html',
50
-        'error_append_string=',
51
-        'error_prepend_string=',
52
-        'error_reporting=-1',
53
-        'html_errors=0',
54
-        'log_errors=0',
55
-        'magic_quotes_runtime=0',
56
-        'output_handler=',
57
-        'open_basedir=',
58
-        'output_buffering=Off',
59
-        'report_memleaks=0',
60
-        'report_zend_debug=0',
61
-        'safe_mode=0',
62
-        'xdebug.default_enable=0'
63
-    ];
64
-
65
-    /**
66
-     * Constructs a test case with the given filename.
67
-     *
68
-     * @param string             $filename
69
-     * @param AbstractPhpProcess $phpUtil
70
-     *
71
-     * @throws Exception
72
-     */
73
-    public function __construct($filename, $phpUtil = null)
74
-    {
75
-        if (!\is_string($filename)) {
76
-            throw InvalidArgumentHelper::factory(1, 'string');
77
-        }
78
-
79
-        if (!\is_file($filename)) {
80
-            throw new Exception(
81
-                \sprintf(
82
-                    'File "%s" does not exist.',
83
-                    $filename
84
-                )
85
-            );
86
-        }
87
-
88
-        $this->filename = $filename;
89
-        $this->phpUtil  = $phpUtil ?: AbstractPhpProcess::factory();
90
-    }
91
-
92
-    /**
93
-     * Counts the number of test cases executed by run(TestResult result).
94
-     *
95
-     * @return int
96
-     */
97
-    public function count()
98
-    {
99
-        return 1;
100
-    }
101
-
102
-    /**
103
-     * @param array  $sections
104
-     * @param string $output
105
-     *
106
-     * @throws Exception
107
-     */
108
-    private function assertPhptExpectation(array $sections, $output)
109
-    {
110
-        $assertions = [
111
-            'EXPECT'      => 'assertEquals',
112
-            'EXPECTF'     => 'assertStringMatchesFormat',
113
-            'EXPECTREGEX' => 'assertRegExp',
114
-        ];
115
-
116
-        $actual = \preg_replace('/\r\n/', "\n", \trim($output));
117
-
118
-        foreach ($assertions as $sectionName => $sectionAssertion) {
119
-            if (isset($sections[$sectionName])) {
120
-                $sectionContent = \preg_replace('/\r\n/', "\n", \trim($sections[$sectionName]));
121
-                $assertion      = $sectionAssertion;
122
-                $expected       = $sectionName === 'EXPECTREGEX' ? "/{$sectionContent}/" : $sectionContent;
123
-
124
-                break;
125
-            }
126
-        }
127
-
128
-        if (!isset($assertion)) {
129
-            throw new Exception('No PHPT assertion found');
130
-        }
131
-
132
-        if (!isset($expected)) {
133
-            throw new Exception('No PHPT expectation found');
134
-        }
135
-
136
-        Assert::$assertion($expected, $actual);
137
-    }
138
-
139
-    /**
140
-     * Runs a test and collects its result in a TestResult instance.
141
-     *
142
-     * @param TestResult $result
143
-     *
144
-     * @return TestResult
145
-     */
146
-    public function run(TestResult $result = null)
147
-    {
148
-        $sections = $this->parse();
149
-        $code     = $this->render($sections['FILE']);
150
-
151
-        if ($result === null) {
152
-            $result = new TestResult;
153
-        }
154
-
155
-        $skip     = false;
156
-        $xfail    = false;
157
-        $time     = 0;
158
-        $settings = $this->settings;
159
-
160
-        $result->startTest($this);
161
-
162
-        if (isset($sections['INI'])) {
163
-            $settings = \array_merge($settings, $this->parseIniSection($sections['INI']));
164
-        }
165
-
166
-        if (isset($sections['ENV'])) {
167
-            $env = $this->parseEnvSection($sections['ENV']);
168
-            $this->phpUtil->setEnv($env);
169
-        }
170
-
171
-        // Redirects STDERR to STDOUT
172
-        $this->phpUtil->setUseStderrRedirection(true);
173
-
174
-        if ($result->enforcesTimeLimit()) {
175
-            $this->phpUtil->setTimeout($result->getTimeoutForLargeTests());
176
-        }
177
-
178
-        if (isset($sections['SKIPIF'])) {
179
-            $skipif    = $this->render($sections['SKIPIF']);
180
-            $jobResult = $this->phpUtil->runJob($skipif, $settings);
181
-
182
-            if (!\strncasecmp('skip', \ltrim($jobResult['stdout']), 4)) {
183
-                if (\preg_match('/^\s*skip\s*(.+)\s*/i', $jobResult['stdout'], $message)) {
184
-                    $message = \substr($message[1], 2);
185
-                } else {
186
-                    $message = '';
187
-                }
188
-
189
-                $result->addFailure($this, new SkippedTestError($message), 0);
190
-
191
-                $skip = true;
192
-            }
193
-        }
194
-
195
-        if (isset($sections['XFAIL'])) {
196
-            $xfail = \trim($sections['XFAIL']);
197
-        }
198
-
199
-        if (!$skip) {
200
-            if (isset($sections['STDIN'])) {
201
-                $this->phpUtil->setStdin($sections['STDIN']);
202
-            }
203
-
204
-            if (isset($sections['ARGS'])) {
205
-                $this->phpUtil->setArgs($sections['ARGS']);
206
-            }
207
-
208
-            PHP_Timer::start();
209
-
210
-            $jobResult = $this->phpUtil->runJob($code, $settings);
211
-            $time      = PHP_Timer::stop();
212
-
213
-            try {
214
-                $this->assertPhptExpectation($sections, $jobResult['stdout']);
215
-            } catch (AssertionFailedError $e) {
216
-                if ($xfail !== false) {
217
-                    $result->addFailure(
218
-                        $this,
219
-                        new IncompleteTestError(
220
-                            $xfail,
221
-                            0,
222
-                            $e
223
-                        ),
224
-                        $time
225
-                    );
226
-                } else {
227
-                    $result->addFailure($this, $e, $time);
228
-                }
229
-            } catch (Throwable $t) {
230
-                $result->addError($this, $t, $time);
231
-            }
232
-
233
-            if ($result->allCompletelyImplemented() && $xfail !== false) {
234
-                $result->addFailure(
235
-                    $this,
236
-                    new IncompleteTestError(
237
-                        'XFAIL section but test passes'
238
-                    ),
239
-                    $time
240
-                );
241
-            }
242
-
243
-            $this->phpUtil->setStdin('');
244
-            $this->phpUtil->setArgs('');
245
-
246
-            if (isset($sections['CLEAN'])) {
247
-                $cleanCode = $this->render($sections['CLEAN']);
248
-
249
-                $this->phpUtil->runJob($cleanCode, $this->settings);
250
-            }
251
-        }
252
-
253
-        $result->endTest($this, $time);
254
-
255
-        return $result;
256
-    }
257
-
258
-    /**
259
-     * Returns the name of the test case.
260
-     *
261
-     * @return string
262
-     */
263
-    public function getName()
264
-    {
265
-        return $this->toString();
266
-    }
267
-
268
-    /**
269
-     * Returns a string representation of the test case.
270
-     *
271
-     * @return string
272
-     */
273
-    public function toString()
274
-    {
275
-        return $this->filename;
276
-    }
277
-
278
-    /**
279
-     * @return array
280
-     *
281
-     * @throws Exception
282
-     */
283
-    private function parse()
284
-    {
285
-        $sections = [];
286
-        $section  = '';
287
-
288
-        $allowExternalSections = [
289
-            'FILE',
290
-            'EXPECT',
291
-            'EXPECTF',
292
-            'EXPECTREGEX'
293
-        ];
294
-
295
-        $requiredSections = [
296
-            'FILE',
297
-            [
298
-                'EXPECT',
299
-                'EXPECTF',
300
-                'EXPECTREGEX'
301
-            ]
302
-        ];
303
-
304
-        $unsupportedSections = [
305
-            'REDIRECTTEST',
306
-            'REQUEST',
307
-            'POST',
308
-            'PUT',
309
-            'POST_RAW',
310
-            'GZIP_POST',
311
-            'DEFLATE_POST',
312
-            'GET',
313
-            'COOKIE',
314
-            'HEADERS',
315
-            'CGI',
316
-            'EXPECTHEADERS',
317
-            'EXTENSIONS',
318
-            'PHPDBG'
319
-        ];
320
-
321
-        foreach (\file($this->filename) as $line) {
322
-            if (\preg_match('/^--([_A-Z]+)--/', $line, $result)) {
323
-                $section            = $result[1];
324
-                $sections[$section] = '';
325
-
326
-                continue;
327
-            } elseif (empty($section)) {
328
-                throw new Exception('Invalid PHPT file');
329
-            }
330
-
331
-            $sections[$section] .= $line;
332
-        }
333
-
334
-        if (isset($sections['FILEEOF'])) {
335
-            $sections['FILE'] = \rtrim($sections['FILEEOF'], "\r\n");
336
-            unset($sections['FILEEOF']);
337
-        }
338
-
339
-        $testDirectory = \dirname($this->filename) . DIRECTORY_SEPARATOR;
340
-
341
-        foreach ($allowExternalSections as $section) {
342
-            if (isset($sections[$section . '_EXTERNAL'])) {
343
-                $externalFilename = \trim($sections[$section . '_EXTERNAL']);
344
-
345
-                if (!\is_file($testDirectory . $externalFilename) || !\is_readable($testDirectory . $externalFilename)) {
346
-                    throw new Exception(
347
-                        \sprintf(
348
-                            'Could not load --%s-- %s for PHPT file',
349
-                            $section . '_EXTERNAL',
350
-                            $testDirectory . $externalFilename
351
-                        )
352
-                    );
353
-                }
354
-
355
-                $sections[$section] = \file_get_contents($testDirectory . $externalFilename);
356
-
357
-                unset($sections[$section . '_EXTERNAL']);
358
-            }
359
-        }
360
-
361
-        $isValid = true;
362
-
363
-        foreach ($requiredSections as $section) {
364
-            if (\is_array($section)) {
365
-                $foundSection = false;
366
-
367
-                foreach ($section as $anySection) {
368
-                    if (isset($sections[$anySection])) {
369
-                        $foundSection = true;
370
-
371
-                        break;
372
-                    }
373
-                }
374
-
375
-                if (!$foundSection) {
376
-                    $isValid = false;
377
-
378
-                    break;
379
-                }
380
-            } else {
381
-                if (!isset($sections[$section])) {
382
-                    $isValid = false;
383
-
384
-                    break;
385
-                }
386
-            }
387
-        }
388
-
389
-        if (!$isValid) {
390
-            throw new Exception('Invalid PHPT file');
391
-        }
392
-
393
-        foreach ($unsupportedSections as $section) {
394
-            if (isset($sections[$section])) {
395
-                throw new Exception(
396
-                    'PHPUnit does not support this PHPT file'
397
-                );
398
-            }
399
-        }
400
-
401
-        return $sections;
402
-    }
403
-
404
-    /**
405
-     * @param string $code
406
-     *
407
-     * @return string
408
-     */
409
-    private function render($code)
410
-    {
411
-        return \str_replace(
412
-            [
413
-                '__DIR__',
414
-                '__FILE__'
415
-            ],
416
-            [
417
-                "'" . \dirname($this->filename) . "'",
418
-                "'" . $this->filename . "'"
419
-            ],
420
-            $code
421
-        );
422
-    }
423
-
424
-    /**
425
-     * Parse --INI-- section key value pairs and return as array.
426
-     *
427
-     * @param string
428
-     *
429
-     * @return array
430
-     */
431
-    protected function parseIniSection($content)
432
-    {
433
-        return \preg_split('/\n|\r/', $content, -1, PREG_SPLIT_NO_EMPTY);
434
-    }
435
-
436
-    /**
437
-     * @param string $content
438
-     *
439
-     * @return array<string, string>
440
-     */
441
-    protected function parseEnvSection($content)
442
-    {
443
-        $env = [];
444
-
445
-        foreach (\explode("\n", \trim($content)) as $e) {
446
-            $e = \explode('=', \trim($e), 2);
447
-
448
-            if (!empty($e[0]) && isset($e[1])) {
449
-                $env[$e[0]] = $e[1];
450
-            }
451
-        }
452
-
453
-        return $env;
454
-    }
29
+	/**
30
+	 * @var string
31
+	 */
32
+	private $filename;
33
+
34
+	/**
35
+	 * @var AbstractPhpProcess
36
+	 */
37
+	private $phpUtil;
38
+
39
+	/**
40
+	 * @var array
41
+	 */
42
+	private $settings = [
43
+		'allow_url_fopen=1',
44
+		'auto_append_file=',
45
+		'auto_prepend_file=',
46
+		'disable_functions=',
47
+		'display_errors=1',
48
+		'docref_root=',
49
+		'docref_ext=.html',
50
+		'error_append_string=',
51
+		'error_prepend_string=',
52
+		'error_reporting=-1',
53
+		'html_errors=0',
54
+		'log_errors=0',
55
+		'magic_quotes_runtime=0',
56
+		'output_handler=',
57
+		'open_basedir=',
58
+		'output_buffering=Off',
59
+		'report_memleaks=0',
60
+		'report_zend_debug=0',
61
+		'safe_mode=0',
62
+		'xdebug.default_enable=0'
63
+	];
64
+
65
+	/**
66
+	 * Constructs a test case with the given filename.
67
+	 *
68
+	 * @param string             $filename
69
+	 * @param AbstractPhpProcess $phpUtil
70
+	 *
71
+	 * @throws Exception
72
+	 */
73
+	public function __construct($filename, $phpUtil = null)
74
+	{
75
+		if (!\is_string($filename)) {
76
+			throw InvalidArgumentHelper::factory(1, 'string');
77
+		}
78
+
79
+		if (!\is_file($filename)) {
80
+			throw new Exception(
81
+				\sprintf(
82
+					'File "%s" does not exist.',
83
+					$filename
84
+				)
85
+			);
86
+		}
87
+
88
+		$this->filename = $filename;
89
+		$this->phpUtil  = $phpUtil ?: AbstractPhpProcess::factory();
90
+	}
91
+
92
+	/**
93
+	 * Counts the number of test cases executed by run(TestResult result).
94
+	 *
95
+	 * @return int
96
+	 */
97
+	public function count()
98
+	{
99
+		return 1;
100
+	}
101
+
102
+	/**
103
+	 * @param array  $sections
104
+	 * @param string $output
105
+	 *
106
+	 * @throws Exception
107
+	 */
108
+	private function assertPhptExpectation(array $sections, $output)
109
+	{
110
+		$assertions = [
111
+			'EXPECT'      => 'assertEquals',
112
+			'EXPECTF'     => 'assertStringMatchesFormat',
113
+			'EXPECTREGEX' => 'assertRegExp',
114
+		];
115
+
116
+		$actual = \preg_replace('/\r\n/', "\n", \trim($output));
117
+
118
+		foreach ($assertions as $sectionName => $sectionAssertion) {
119
+			if (isset($sections[$sectionName])) {
120
+				$sectionContent = \preg_replace('/\r\n/', "\n", \trim($sections[$sectionName]));
121
+				$assertion      = $sectionAssertion;
122
+				$expected       = $sectionName === 'EXPECTREGEX' ? "/{$sectionContent}/" : $sectionContent;
123
+
124
+				break;
125
+			}
126
+		}
127
+
128
+		if (!isset($assertion)) {
129
+			throw new Exception('No PHPT assertion found');
130
+		}
131
+
132
+		if (!isset($expected)) {
133
+			throw new Exception('No PHPT expectation found');
134
+		}
135
+
136
+		Assert::$assertion($expected, $actual);
137
+	}
138
+
139
+	/**
140
+	 * Runs a test and collects its result in a TestResult instance.
141
+	 *
142
+	 * @param TestResult $result
143
+	 *
144
+	 * @return TestResult
145
+	 */
146
+	public function run(TestResult $result = null)
147
+	{
148
+		$sections = $this->parse();
149
+		$code     = $this->render($sections['FILE']);
150
+
151
+		if ($result === null) {
152
+			$result = new TestResult;
153
+		}
154
+
155
+		$skip     = false;
156
+		$xfail    = false;
157
+		$time     = 0;
158
+		$settings = $this->settings;
159
+
160
+		$result->startTest($this);
161
+
162
+		if (isset($sections['INI'])) {
163
+			$settings = \array_merge($settings, $this->parseIniSection($sections['INI']));
164
+		}
165
+
166
+		if (isset($sections['ENV'])) {
167
+			$env = $this->parseEnvSection($sections['ENV']);
168
+			$this->phpUtil->setEnv($env);
169
+		}
170
+
171
+		// Redirects STDERR to STDOUT
172
+		$this->phpUtil->setUseStderrRedirection(true);
173
+
174
+		if ($result->enforcesTimeLimit()) {
175
+			$this->phpUtil->setTimeout($result->getTimeoutForLargeTests());
176
+		}
177
+
178
+		if (isset($sections['SKIPIF'])) {
179
+			$skipif    = $this->render($sections['SKIPIF']);
180
+			$jobResult = $this->phpUtil->runJob($skipif, $settings);
181
+
182
+			if (!\strncasecmp('skip', \ltrim($jobResult['stdout']), 4)) {
183
+				if (\preg_match('/^\s*skip\s*(.+)\s*/i', $jobResult['stdout'], $message)) {
184
+					$message = \substr($message[1], 2);
185
+				} else {
186
+					$message = '';
187
+				}
188
+
189
+				$result->addFailure($this, new SkippedTestError($message), 0);
190
+
191
+				$skip = true;
192
+			}
193
+		}
194
+
195
+		if (isset($sections['XFAIL'])) {
196
+			$xfail = \trim($sections['XFAIL']);
197
+		}
198
+
199
+		if (!$skip) {
200
+			if (isset($sections['STDIN'])) {
201
+				$this->phpUtil->setStdin($sections['STDIN']);
202
+			}
203
+
204
+			if (isset($sections['ARGS'])) {
205
+				$this->phpUtil->setArgs($sections['ARGS']);
206
+			}
207
+
208
+			PHP_Timer::start();
209
+
210
+			$jobResult = $this->phpUtil->runJob($code, $settings);
211
+			$time      = PHP_Timer::stop();
212
+
213
+			try {
214
+				$this->assertPhptExpectation($sections, $jobResult['stdout']);
215
+			} catch (AssertionFailedError $e) {
216
+				if ($xfail !== false) {
217
+					$result->addFailure(
218
+						$this,
219
+						new IncompleteTestError(
220
+							$xfail,
221
+							0,
222
+							$e
223
+						),
224
+						$time
225
+					);
226
+				} else {
227
+					$result->addFailure($this, $e, $time);
228
+				}
229
+			} catch (Throwable $t) {
230
+				$result->addError($this, $t, $time);
231
+			}
232
+
233
+			if ($result->allCompletelyImplemented() && $xfail !== false) {
234
+				$result->addFailure(
235
+					$this,
236
+					new IncompleteTestError(
237
+						'XFAIL section but test passes'
238
+					),
239
+					$time
240
+				);
241
+			}
242
+
243
+			$this->phpUtil->setStdin('');
244
+			$this->phpUtil->setArgs('');
245
+
246
+			if (isset($sections['CLEAN'])) {
247
+				$cleanCode = $this->render($sections['CLEAN']);
248
+
249
+				$this->phpUtil->runJob($cleanCode, $this->settings);
250
+			}
251
+		}
252
+
253
+		$result->endTest($this, $time);
254
+
255
+		return $result;
256
+	}
257
+
258
+	/**
259
+	 * Returns the name of the test case.
260
+	 *
261
+	 * @return string
262
+	 */
263
+	public function getName()
264
+	{
265
+		return $this->toString();
266
+	}
267
+
268
+	/**
269
+	 * Returns a string representation of the test case.
270
+	 *
271
+	 * @return string
272
+	 */
273
+	public function toString()
274
+	{
275
+		return $this->filename;
276
+	}
277
+
278
+	/**
279
+	 * @return array
280
+	 *
281
+	 * @throws Exception
282
+	 */
283
+	private function parse()
284
+	{
285
+		$sections = [];
286
+		$section  = '';
287
+
288
+		$allowExternalSections = [
289
+			'FILE',
290
+			'EXPECT',
291
+			'EXPECTF',
292
+			'EXPECTREGEX'
293
+		];
294
+
295
+		$requiredSections = [
296
+			'FILE',
297
+			[
298
+				'EXPECT',
299
+				'EXPECTF',
300
+				'EXPECTREGEX'
301
+			]
302
+		];
303
+
304
+		$unsupportedSections = [
305
+			'REDIRECTTEST',
306
+			'REQUEST',
307
+			'POST',
308
+			'PUT',
309
+			'POST_RAW',
310
+			'GZIP_POST',
311
+			'DEFLATE_POST',
312
+			'GET',
313
+			'COOKIE',
314
+			'HEADERS',
315
+			'CGI',
316
+			'EXPECTHEADERS',
317
+			'EXTENSIONS',
318
+			'PHPDBG'
319
+		];
320
+
321
+		foreach (\file($this->filename) as $line) {
322
+			if (\preg_match('/^--([_A-Z]+)--/', $line, $result)) {
323
+				$section            = $result[1];
324
+				$sections[$section] = '';
325
+
326
+				continue;
327
+			} elseif (empty($section)) {
328
+				throw new Exception('Invalid PHPT file');
329
+			}
330
+
331
+			$sections[$section] .= $line;
332
+		}
333
+
334
+		if (isset($sections['FILEEOF'])) {
335
+			$sections['FILE'] = \rtrim($sections['FILEEOF'], "\r\n");
336
+			unset($sections['FILEEOF']);
337
+		}
338
+
339
+		$testDirectory = \dirname($this->filename) . DIRECTORY_SEPARATOR;
340
+
341
+		foreach ($allowExternalSections as $section) {
342
+			if (isset($sections[$section . '_EXTERNAL'])) {
343
+				$externalFilename = \trim($sections[$section . '_EXTERNAL']);
344
+
345
+				if (!\is_file($testDirectory . $externalFilename) || !\is_readable($testDirectory . $externalFilename)) {
346
+					throw new Exception(
347
+						\sprintf(
348
+							'Could not load --%s-- %s for PHPT file',
349
+							$section . '_EXTERNAL',
350
+							$testDirectory . $externalFilename
351
+						)
352
+					);
353
+				}
354
+
355
+				$sections[$section] = \file_get_contents($testDirectory . $externalFilename);
356
+
357
+				unset($sections[$section . '_EXTERNAL']);
358
+			}
359
+		}
360
+
361
+		$isValid = true;
362
+
363
+		foreach ($requiredSections as $section) {
364
+			if (\is_array($section)) {
365
+				$foundSection = false;
366
+
367
+				foreach ($section as $anySection) {
368
+					if (isset($sections[$anySection])) {
369
+						$foundSection = true;
370
+
371
+						break;
372
+					}
373
+				}
374
+
375
+				if (!$foundSection) {
376
+					$isValid = false;
377
+
378
+					break;
379
+				}
380
+			} else {
381
+				if (!isset($sections[$section])) {
382
+					$isValid = false;
383
+
384
+					break;
385
+				}
386
+			}
387
+		}
388
+
389
+		if (!$isValid) {
390
+			throw new Exception('Invalid PHPT file');
391
+		}
392
+
393
+		foreach ($unsupportedSections as $section) {
394
+			if (isset($sections[$section])) {
395
+				throw new Exception(
396
+					'PHPUnit does not support this PHPT file'
397
+				);
398
+			}
399
+		}
400
+
401
+		return $sections;
402
+	}
403
+
404
+	/**
405
+	 * @param string $code
406
+	 *
407
+	 * @return string
408
+	 */
409
+	private function render($code)
410
+	{
411
+		return \str_replace(
412
+			[
413
+				'__DIR__',
414
+				'__FILE__'
415
+			],
416
+			[
417
+				"'" . \dirname($this->filename) . "'",
418
+				"'" . $this->filename . "'"
419
+			],
420
+			$code
421
+		);
422
+	}
423
+
424
+	/**
425
+	 * Parse --INI-- section key value pairs and return as array.
426
+	 *
427
+	 * @param string
428
+	 *
429
+	 * @return array
430
+	 */
431
+	protected function parseIniSection($content)
432
+	{
433
+		return \preg_split('/\n|\r/', $content, -1, PREG_SPLIT_NO_EMPTY);
434
+	}
435
+
436
+	/**
437
+	 * @param string $content
438
+	 *
439
+	 * @return array<string, string>
440
+	 */
441
+	protected function parseEnvSection($content)
442
+	{
443
+		$env = [];
444
+
445
+		foreach (\explode("\n", \trim($content)) as $e) {
446
+			$e = \explode('=', \trim($e), 2);
447
+
448
+			if (!empty($e[0]) && isset($e[1])) {
449
+				$env[$e[0]] = $e[1];
450
+			}
451
+		}
452
+
453
+		return $env;
454
+	}
455 455
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Runner/TestSuiteLoader.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@
 block discarded – undo
17 17
  */
18 18
 interface TestSuiteLoader
19 19
 {
20
-    /**
21
-     * @param string $suiteClassName
22
-     * @param string $suiteClassFile
23
-     *
24
-     * @return ReflectionClass
25
-     */
26
-    public function load($suiteClassName, $suiteClassFile = '');
20
+	/**
21
+	 * @param string $suiteClassName
22
+	 * @param string $suiteClassFile
23
+	 *
24
+	 * @return ReflectionClass
25
+	 */
26
+	public function load($suiteClassName, $suiteClassFile = '');
27 27
 
28
-    /**
29
-     * @param ReflectionClass $aClass
30
-     *
31
-     * @return ReflectionClass
32
-     */
33
-    public function reload(ReflectionClass $aClass);
28
+	/**
29
+	 * @param ReflectionClass $aClass
30
+	 *
31
+	 * @return ReflectionClass
32
+	 */
33
+	public function reload(ReflectionClass $aClass);
34 34
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -19,102 +19,102 @@
 block discarded – undo
19 19
  */
20 20
 class StandardTestSuiteLoader implements TestSuiteLoader
21 21
 {
22
-    /**
23
-     * @param string $suiteClassName
24
-     * @param string $suiteClassFile
25
-     *
26
-     * @return ReflectionClass
27
-     *
28
-     * @throws Exception
29
-     */
30
-    public function load($suiteClassName, $suiteClassFile = '')
31
-    {
32
-        $suiteClassName = \str_replace('.php', '', $suiteClassName);
33
-
34
-        if (empty($suiteClassFile)) {
35
-            $suiteClassFile = Filesystem::classNameToFilename(
36
-                $suiteClassName
37
-            );
38
-        }
39
-
40
-        if (!\class_exists($suiteClassName, false)) {
41
-            $loadedClasses = \get_declared_classes();
42
-
43
-            $filename = Fileloader::checkAndLoad($suiteClassFile);
44
-
45
-            $loadedClasses = \array_values(
46
-                \array_diff(\get_declared_classes(), $loadedClasses)
47
-            );
48
-        }
49
-
50
-        if (!\class_exists($suiteClassName, false) && !empty($loadedClasses)) {
51
-            $offset = 0 - \strlen($suiteClassName);
52
-
53
-            foreach ($loadedClasses as $loadedClass) {
54
-                $class = new ReflectionClass($loadedClass);
55
-                if (\substr($loadedClass, $offset) === $suiteClassName &&
56
-                    $class->getFileName() == $filename) {
57
-                    $suiteClassName = $loadedClass;
58
-
59
-                    break;
60
-                }
61
-            }
62
-        }
63
-
64
-        if (!\class_exists($suiteClassName, false) && !empty($loadedClasses)) {
65
-            $testCaseClass = TestCase::class;
66
-
67
-            foreach ($loadedClasses as $loadedClass) {
68
-                $class     = new ReflectionClass($loadedClass);
69
-                $classFile = $class->getFileName();
70
-
71
-                if ($class->isSubclassOf($testCaseClass) && !$class->isAbstract()) {
72
-                    $suiteClassName = $loadedClass;
73
-                    $testCaseClass  = $loadedClass;
74
-
75
-                    if ($classFile == \realpath($suiteClassFile)) {
76
-                        break;
77
-                    }
78
-                }
79
-
80
-                if ($class->hasMethod('suite')) {
81
-                    $method = $class->getMethod('suite');
82
-
83
-                    if (!$method->isAbstract() && $method->isPublic() && $method->isStatic()) {
84
-                        $suiteClassName = $loadedClass;
85
-
86
-                        if ($classFile == \realpath($suiteClassFile)) {
87
-                            break;
88
-                        }
89
-                    }
90
-                }
91
-            }
92
-        }
93
-
94
-        if (\class_exists($suiteClassName, false)) {
95
-            $class = new ReflectionClass($suiteClassName);
96
-
97
-            if ($class->getFileName() == \realpath($suiteClassFile)) {
98
-                return $class;
99
-            }
100
-        }
101
-
102
-        throw new Exception(
103
-            \sprintf(
104
-                "Class '%s' could not be found in '%s'.",
105
-                $suiteClassName,
106
-                $suiteClassFile
107
-            )
108
-        );
109
-    }
110
-
111
-    /**
112
-     * @param ReflectionClass $aClass
113
-     *
114
-     * @return ReflectionClass
115
-     */
116
-    public function reload(ReflectionClass $aClass)
117
-    {
118
-        return $aClass;
119
-    }
22
+	/**
23
+	 * @param string $suiteClassName
24
+	 * @param string $suiteClassFile
25
+	 *
26
+	 * @return ReflectionClass
27
+	 *
28
+	 * @throws Exception
29
+	 */
30
+	public function load($suiteClassName, $suiteClassFile = '')
31
+	{
32
+		$suiteClassName = \str_replace('.php', '', $suiteClassName);
33
+
34
+		if (empty($suiteClassFile)) {
35
+			$suiteClassFile = Filesystem::classNameToFilename(
36
+				$suiteClassName
37
+			);
38
+		}
39
+
40
+		if (!\class_exists($suiteClassName, false)) {
41
+			$loadedClasses = \get_declared_classes();
42
+
43
+			$filename = Fileloader::checkAndLoad($suiteClassFile);
44
+
45
+			$loadedClasses = \array_values(
46
+				\array_diff(\get_declared_classes(), $loadedClasses)
47
+			);
48
+		}
49
+
50
+		if (!\class_exists($suiteClassName, false) && !empty($loadedClasses)) {
51
+			$offset = 0 - \strlen($suiteClassName);
52
+
53
+			foreach ($loadedClasses as $loadedClass) {
54
+				$class = new ReflectionClass($loadedClass);
55
+				if (\substr($loadedClass, $offset) === $suiteClassName &&
56
+					$class->getFileName() == $filename) {
57
+					$suiteClassName = $loadedClass;
58
+
59
+					break;
60
+				}
61
+			}
62
+		}
63
+
64
+		if (!\class_exists($suiteClassName, false) && !empty($loadedClasses)) {
65
+			$testCaseClass = TestCase::class;
66
+
67
+			foreach ($loadedClasses as $loadedClass) {
68
+				$class     = new ReflectionClass($loadedClass);
69
+				$classFile = $class->getFileName();
70
+
71
+				if ($class->isSubclassOf($testCaseClass) && !$class->isAbstract()) {
72
+					$suiteClassName = $loadedClass;
73
+					$testCaseClass  = $loadedClass;
74
+
75
+					if ($classFile == \realpath($suiteClassFile)) {
76
+						break;
77
+					}
78
+				}
79
+
80
+				if ($class->hasMethod('suite')) {
81
+					$method = $class->getMethod('suite');
82
+
83
+					if (!$method->isAbstract() && $method->isPublic() && $method->isStatic()) {
84
+						$suiteClassName = $loadedClass;
85
+
86
+						if ($classFile == \realpath($suiteClassFile)) {
87
+							break;
88
+						}
89
+					}
90
+				}
91
+			}
92
+		}
93
+
94
+		if (\class_exists($suiteClassName, false)) {
95
+			$class = new ReflectionClass($suiteClassName);
96
+
97
+			if ($class->getFileName() == \realpath($suiteClassFile)) {
98
+				return $class;
99
+			}
100
+		}
101
+
102
+		throw new Exception(
103
+			\sprintf(
104
+				"Class '%s' could not be found in '%s'.",
105
+				$suiteClassName,
106
+				$suiteClassFile
107
+			)
108
+		);
109
+	}
110
+
111
+	/**
112
+	 * @param ReflectionClass $aClass
113
+	 *
114
+	 * @return ReflectionClass
115
+	 */
116
+	public function reload(ReflectionClass $aClass)
117
+	{
118
+		return $aClass;
119
+	}
120 120
 }
Please login to merge, or discard this patch.
vendor/phpunit/php-timer/tests/TimerTest.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -12,87 +12,87 @@
 block discarded – undo
12 12
 
13 13
 class PHP_TimerTest extends TestCase
14 14
 {
15
-    /**
16
-     * @covers PHP_Timer::start
17
-     * @covers PHP_Timer::stop
18
-     */
19
-    public function testStartStop()
20
-    {
21
-        $this->assertInternalType('float', PHP_Timer::stop());
22
-    }
15
+	/**
16
+	 * @covers PHP_Timer::start
17
+	 * @covers PHP_Timer::stop
18
+	 */
19
+	public function testStartStop()
20
+	{
21
+		$this->assertInternalType('float', PHP_Timer::stop());
22
+	}
23 23
 
24
-    /**
25
-     * @covers       PHP_Timer::secondsToTimeString
26
-     * @dataProvider secondsProvider
27
-     */
28
-    public function testSecondsToTimeString($string, $seconds)
29
-    {
30
-        $this->assertEquals(
31
-            $string,
32
-            PHP_Timer::secondsToTimeString($seconds)
33
-        );
34
-    }
24
+	/**
25
+	 * @covers       PHP_Timer::secondsToTimeString
26
+	 * @dataProvider secondsProvider
27
+	 */
28
+	public function testSecondsToTimeString($string, $seconds)
29
+	{
30
+		$this->assertEquals(
31
+			$string,
32
+			PHP_Timer::secondsToTimeString($seconds)
33
+		);
34
+	}
35 35
 
36
-    /**
37
-     * @covers PHP_Timer::timeSinceStartOfRequest
38
-     */
39
-    public function testTimeSinceStartOfRequest()
40
-    {
41
-        $this->assertStringMatchesFormat(
42
-            '%f %s',
43
-            PHP_Timer::timeSinceStartOfRequest()
44
-        );
45
-    }
36
+	/**
37
+	 * @covers PHP_Timer::timeSinceStartOfRequest
38
+	 */
39
+	public function testTimeSinceStartOfRequest()
40
+	{
41
+		$this->assertStringMatchesFormat(
42
+			'%f %s',
43
+			PHP_Timer::timeSinceStartOfRequest()
44
+		);
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * @covers PHP_Timer::resourceUsage
50
-     */
51
-    public function testResourceUsage()
52
-    {
53
-        $this->assertStringMatchesFormat(
54
-            'Time: %s, Memory: %fMB',
55
-            PHP_Timer::resourceUsage()
56
-        );
57
-    }
48
+	/**
49
+	 * @covers PHP_Timer::resourceUsage
50
+	 */
51
+	public function testResourceUsage()
52
+	{
53
+		$this->assertStringMatchesFormat(
54
+			'Time: %s, Memory: %fMB',
55
+			PHP_Timer::resourceUsage()
56
+		);
57
+	}
58 58
 
59
-    public function secondsProvider()
60
-    {
61
-        return array(
62
-          array('0 ms', 0),
63
-          array('1 ms', .001),
64
-          array('10 ms', .01),
65
-          array('100 ms', .1),
66
-          array('999 ms', .999),
67
-          array('1 second', .9999),
68
-          array('1 second', 1),
69
-          array('2 seconds', 2),
70
-          array('59.9 seconds', 59.9),
71
-          array('59.99 seconds', 59.99),
72
-          array('59.99 seconds', 59.999),
73
-          array('1 minute', 59.9999),
74
-          array('59 seconds', 59.001),
75
-          array('59.01 seconds', 59.01),
76
-          array('1 minute', 60),
77
-          array('1.01 minutes', 61),
78
-          array('2 minutes', 120),
79
-          array('2.01 minutes', 121),
80
-          array('59.99 minutes', 3599.9),
81
-          array('59.99 minutes', 3599.99),
82
-          array('59.99 minutes', 3599.999),
83
-          array('1 hour', 3599.9999),
84
-          array('59.98 minutes', 3599.001),
85
-          array('59.98 minutes', 3599.01),
86
-          array('1 hour', 3600),
87
-          array('1 hour', 3601),
88
-          array('1 hour', 3601.9),
89
-          array('1 hour', 3601.99),
90
-          array('1 hour', 3601.999),
91
-          array('1 hour', 3601.9999),
92
-          array('1.01 hours', 3659.9999),
93
-          array('1.01 hours', 3659.001),
94
-          array('1.01 hours', 3659.01),
95
-          array('2 hours', 7199.9999),
96
-        );
97
-    }
59
+	public function secondsProvider()
60
+	{
61
+		return array(
62
+		  array('0 ms', 0),
63
+		  array('1 ms', .001),
64
+		  array('10 ms', .01),
65
+		  array('100 ms', .1),
66
+		  array('999 ms', .999),
67
+		  array('1 second', .9999),
68
+		  array('1 second', 1),
69
+		  array('2 seconds', 2),
70
+		  array('59.9 seconds', 59.9),
71
+		  array('59.99 seconds', 59.99),
72
+		  array('59.99 seconds', 59.999),
73
+		  array('1 minute', 59.9999),
74
+		  array('59 seconds', 59.001),
75
+		  array('59.01 seconds', 59.01),
76
+		  array('1 minute', 60),
77
+		  array('1.01 minutes', 61),
78
+		  array('2 minutes', 120),
79
+		  array('2.01 minutes', 121),
80
+		  array('59.99 minutes', 3599.9),
81
+		  array('59.99 minutes', 3599.99),
82
+		  array('59.99 minutes', 3599.999),
83
+		  array('1 hour', 3599.9999),
84
+		  array('59.98 minutes', 3599.001),
85
+		  array('59.98 minutes', 3599.01),
86
+		  array('1 hour', 3600),
87
+		  array('1 hour', 3601),
88
+		  array('1 hour', 3601.9),
89
+		  array('1 hour', 3601.99),
90
+		  array('1 hour', 3601.999),
91
+		  array('1 hour', 3601.9999),
92
+		  array('1.01 hours', 3659.9999),
93
+		  array('1.01 hours', 3659.001),
94
+		  array('1.01 hours', 3659.01),
95
+		  array('2 hours', 7199.9999),
96
+		);
97
+	}
98 98
 }
Please login to merge, or discard this patch.
vendor/phpunit/php-timer/src/Timer.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -13,93 +13,93 @@
 block discarded – undo
13 13
  */
14 14
 class PHP_Timer
15 15
 {
16
-    /**
17
-     * @var array
18
-     */
19
-    private static $times = array(
20
-      'hour'   => 3600000,
21
-      'minute' => 60000,
22
-      'second' => 1000
23
-    );
16
+	/**
17
+	 * @var array
18
+	 */
19
+	private static $times = array(
20
+	  'hour'   => 3600000,
21
+	  'minute' => 60000,
22
+	  'second' => 1000
23
+	);
24 24
 
25
-    /**
26
-     * @var array
27
-     */
28
-    private static $startTimes = array();
25
+	/**
26
+	 * @var array
27
+	 */
28
+	private static $startTimes = array();
29 29
 
30
-    /**
31
-     * @var float
32
-     */
33
-    public static $requestTime;
30
+	/**
31
+	 * @var float
32
+	 */
33
+	public static $requestTime;
34 34
 
35
-    /**
36
-     * Starts the timer.
37
-     */
38
-    public static function start()
39
-    {
40
-        array_push(self::$startTimes, microtime(true));
41
-    }
35
+	/**
36
+	 * Starts the timer.
37
+	 */
38
+	public static function start()
39
+	{
40
+		array_push(self::$startTimes, microtime(true));
41
+	}
42 42
 
43
-    /**
44
-     * Stops the timer and returns the elapsed time.
45
-     *
46
-     * @return float
47
-     */
48
-    public static function stop()
49
-    {
50
-        return microtime(true) - array_pop(self::$startTimes);
51
-    }
43
+	/**
44
+	 * Stops the timer and returns the elapsed time.
45
+	 *
46
+	 * @return float
47
+	 */
48
+	public static function stop()
49
+	{
50
+		return microtime(true) - array_pop(self::$startTimes);
51
+	}
52 52
 
53
-    /**
54
-     * Formats the elapsed time as a string.
55
-     *
56
-     * @param  float  $time
57
-     * @return string
58
-     */
59
-    public static function secondsToTimeString($time)
60
-    {
61
-        $ms = round($time * 1000);
53
+	/**
54
+	 * Formats the elapsed time as a string.
55
+	 *
56
+	 * @param  float  $time
57
+	 * @return string
58
+	 */
59
+	public static function secondsToTimeString($time)
60
+	{
61
+		$ms = round($time * 1000);
62 62
 
63
-        foreach (self::$times as $unit => $value) {
64
-            if ($ms >= $value) {
65
-                $time = floor($ms / $value * 100.0) / 100.0;
63
+		foreach (self::$times as $unit => $value) {
64
+			if ($ms >= $value) {
65
+				$time = floor($ms / $value * 100.0) / 100.0;
66 66
 
67
-                return $time . ' ' . ($time == 1 ? $unit : $unit . 's');
68
-            }
69
-        }
67
+				return $time . ' ' . ($time == 1 ? $unit : $unit . 's');
68
+			}
69
+		}
70 70
 
71
-        return $ms . ' ms';
72
-    }
71
+		return $ms . ' ms';
72
+	}
73 73
 
74
-    /**
75
-     * Formats the elapsed time since the start of the request as a string.
76
-     *
77
-     * @return string
78
-     */
79
-    public static function timeSinceStartOfRequest()
80
-    {
81
-        return self::secondsToTimeString(microtime(true) - self::$requestTime);
82
-    }
74
+	/**
75
+	 * Formats the elapsed time since the start of the request as a string.
76
+	 *
77
+	 * @return string
78
+	 */
79
+	public static function timeSinceStartOfRequest()
80
+	{
81
+		return self::secondsToTimeString(microtime(true) - self::$requestTime);
82
+	}
83 83
 
84
-    /**
85
-     * Returns the resources (time, memory) of the request as a string.
86
-     *
87
-     * @return string
88
-     */
89
-    public static function resourceUsage()
90
-    {
91
-        return sprintf(
92
-            'Time: %s, Memory: %4.2fMB',
93
-            self::timeSinceStartOfRequest(),
94
-            memory_get_peak_usage(true) / 1048576
95
-        );
96
-    }
84
+	/**
85
+	 * Returns the resources (time, memory) of the request as a string.
86
+	 *
87
+	 * @return string
88
+	 */
89
+	public static function resourceUsage()
90
+	{
91
+		return sprintf(
92
+			'Time: %s, Memory: %4.2fMB',
93
+			self::timeSinceStartOfRequest(),
94
+			memory_get_peak_usage(true) / 1048576
95
+		);
96
+	}
97 97
 }
98 98
 
99 99
 if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
100
-    PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
100
+	PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
101 101
 } elseif (isset($_SERVER['REQUEST_TIME'])) {
102
-    PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME'];
102
+	PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME'];
103 103
 } else {
104
-    PHP_Timer::$requestTime = microtime(true);
104
+	PHP_Timer::$requestTime = microtime(true);
105 105
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit-mock-objects/tests/ProxyObjectTest.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,30 +12,30 @@
 block discarded – undo
12 12
 
13 13
 class Framework_ProxyObjectTest extends TestCase
14 14
 {
15
-    public function testMockedMethodIsProxiedToOriginalMethod()
16
-    {
17
-        $proxy = $this->getMockBuilder(Bar::class)
18
-                      ->enableProxyingToOriginalMethods()
19
-                      ->getMock();
15
+	public function testMockedMethodIsProxiedToOriginalMethod()
16
+	{
17
+		$proxy = $this->getMockBuilder(Bar::class)
18
+					  ->enableProxyingToOriginalMethods()
19
+					  ->getMock();
20 20
 
21
-        $proxy->expects($this->once())
22
-              ->method('doSomethingElse');
21
+		$proxy->expects($this->once())
22
+			  ->method('doSomethingElse');
23 23
 
24
-        $foo = new Foo;
24
+		$foo = new Foo;
25 25
 
26
-        $this->assertEquals('result', $foo->doSomething($proxy));
27
-    }
26
+		$this->assertEquals('result', $foo->doSomething($proxy));
27
+	}
28 28
 
29
-    public function testMockedMethodWithReferenceIsProxiedToOriginalMethod()
30
-    {
31
-        $proxy = $this->getMockBuilder(MethodCallbackByReference::class)
32
-                      ->enableProxyingToOriginalMethods()
33
-                      ->getMock();
29
+	public function testMockedMethodWithReferenceIsProxiedToOriginalMethod()
30
+	{
31
+		$proxy = $this->getMockBuilder(MethodCallbackByReference::class)
32
+					  ->enableProxyingToOriginalMethods()
33
+					  ->getMock();
34 34
 
35
-        $a = $b = $c = 0;
35
+		$a = $b = $c = 0;
36 36
 
37
-        $proxy->callback($a, $b, $c);
37
+		$proxy->callback($a, $b, $c);
38 38
 
39
-        $this->assertEquals(1, $b);
40
-    }
39
+		$this->assertEquals(1, $b);
40
+	}
41 41
 }
Please login to merge, or discard this patch.