1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the phpunit-mink library. |
4
|
|
|
* For the full copyright and license information, please view |
5
|
|
|
* the LICENSE file that was distributed with this source code. |
6
|
|
|
* |
7
|
|
|
* @copyright Alexander Obuhovich <[email protected]> |
8
|
|
|
* @link https://github.com/aik099/phpunit-mink |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace ConsoleHelpers\PHPUnitCompat; |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
use PHPUnit\Runner\Version; |
|
|
|
|
15
|
|
|
|
16
|
|
|
// PHPUnit Compat. |
17
|
|
|
if ( \class_exists('\PHPUnit_Framework_IncompleteTestError') ) { |
18
|
|
|
\class_alias( |
19
|
|
|
'\PHPUnit_Framework_IncompleteTestError', |
20
|
|
|
'\ConsoleHelpers\PHPUnitCompat\Framework\IncompleteTestError' |
21
|
|
|
); |
22
|
|
|
} |
23
|
|
|
else { |
24
|
|
|
\class_alias( |
25
|
|
|
'\PHPUnit\Framework\IncompleteTestError', |
26
|
|
|
'\ConsoleHelpers\PHPUnitCompat\Framework\IncompleteTestError' |
27
|
|
|
); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
if ( class_exists('\PHPUnit_Framework_SkippedTestError') ) { |
31
|
|
|
\class_alias('\PHPUnit_Framework_SkippedTestError', '\ConsoleHelpers\PHPUnitCompat\Framework\SkippedTestError'); |
32
|
|
|
} |
33
|
|
|
else { |
34
|
|
|
\class_alias('\PHPUnit\Framework\SkippedTestError', '\ConsoleHelpers\PHPUnitCompat\Framework\SkippedTestError'); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
if ( class_exists('\PHPUnit_Framework_TestSuite_DataProvider') ) { |
38
|
|
|
\class_alias( |
39
|
|
|
'\PHPUnit_Framework_TestSuite_DataProvider', |
40
|
|
|
'\ConsoleHelpers\PHPUnitCompat\Framework\DataProviderTestSuite' |
41
|
|
|
); |
42
|
|
|
} |
43
|
|
|
else { |
44
|
|
|
\class_alias( |
45
|
|
|
'\PHPUnit\Framework\DataProviderTestSuite', |
46
|
|
|
'\ConsoleHelpers\PHPUnitCompat\Framework\DataProviderTestSuite' |
47
|
|
|
); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
if ( class_exists('\PHPUnit_Framework_TestResult') ) { |
51
|
|
|
\class_alias('\PHPUnit_Framework_TestResult', '\ConsoleHelpers\PHPUnitCompat\Framework\TestResult'); |
52
|
|
|
} |
53
|
|
|
else { |
54
|
|
|
\class_alias('\PHPUnit\Framework\TestResult', '\ConsoleHelpers\PHPUnitCompat\Framework\TestResult'); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
if ( class_exists('\PHPUnit_Framework_Test') ) { |
58
|
|
|
\class_alias('\PHPUnit_Framework_Test', '\ConsoleHelpers\PHPUnitCompat\Framework\Test'); |
59
|
|
|
} |
60
|
|
|
else { |
61
|
|
|
\class_alias('\PHPUnit\Framework\Test', '\ConsoleHelpers\PHPUnitCompat\Framework\Test'); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
if ( !\defined('PHPUNIT_COMPAT_RUNNER_VERSION') ) { |
65
|
|
|
if ( \class_exists('PHPUnit\Runner\Version') ) { |
66
|
|
|
\define('PHPUNIT_COMPAT_RUNNER_VERSION', Version::id()); |
67
|
|
|
} |
68
|
|
|
else { |
69
|
|
|
\define('PHPUNIT_COMPAT_RUNNER_VERSION', \PHPUnit_Runner_Version::id()); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
// CodeCoverage Compat. |
74
|
|
|
if ( class_exists('\PHP_CodeCoverage') ) { |
75
|
|
|
\class_alias('\PHP_CodeCoverage', '\ConsoleHelpers\CodeCoverageCompat\CodeCoverage'); |
76
|
|
|
} |
77
|
|
|
else { |
78
|
|
|
\class_alias( |
79
|
|
|
'\SebastianBergmann\CodeCoverage\CodeCoverage', |
80
|
|
|
'\ConsoleHelpers\CodeCoverageCompat\CodeCoverage' |
81
|
|
|
); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
if ( \interface_exists('\PHP_CodeCoverage_Driver') ) { |
85
|
|
|
\class_alias('\PHP_CodeCoverage_Driver', '\ConsoleHelpers\CodeCoverageCompat\Driver\Driver'); |
86
|
|
|
} |
87
|
|
|
else { |
88
|
|
|
\class_alias( |
89
|
|
|
'\SebastianBergmann\CodeCoverage\Driver\Driver', |
90
|
|
|
'\ConsoleHelpers\CodeCoverageCompat\Driver\Driver' |
91
|
|
|
); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
if ( class_exists('\PHP_CodeCoverage_Filter') ) { |
95
|
|
|
\class_alias('\PHP_CodeCoverage_Filter', '\ConsoleHelpers\CodeCoverageCompat\Filter'); |
96
|
|
|
} |
97
|
|
|
else { |
98
|
|
|
\class_alias('\SebastianBergmann\CodeCoverage\Filter', '\ConsoleHelpers\CodeCoverageCompat\Filter'); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
|
102
|
|
|
trait TAbstractTestCaseBody |
103
|
|
|
{ |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* This method is called when a test method did not execute successfully. |
107
|
|
|
* |
108
|
|
|
* @param \Exception|\Throwable $e Exception. |
109
|
|
|
* |
110
|
|
|
* @return void |
111
|
|
|
*/ |
112
|
1 |
|
protected function onNotSuccessfulTestCompat($e) |
|
|
|
|
113
|
|
|
{ |
114
|
|
|
|
115
|
1 |
|
} |
116
|
|
|
|
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
if ( version_compare(\PHPUNIT_COMPAT_RUNNER_VERSION, '5.0.0', '<') ) { |
120
|
|
|
require_once __DIR__ . '/AbstractTestCase4.php'; |
121
|
|
|
} |
122
|
|
|
elseif ( version_compare(\PHPUNIT_COMPAT_RUNNER_VERSION, '6.0.0', '<') ) { |
123
|
|
|
require_once __DIR__ . '/AbstractTestCase5.php'; |
124
|
|
|
} |
125
|
|
|
elseif ( version_compare(\PHPUNIT_COMPAT_RUNNER_VERSION, '7.0.0', '<') ) { |
126
|
|
|
require_once __DIR__ . '/AbstractTestCase6.php'; |
127
|
|
|
} |
128
|
|
|
elseif ( version_compare(\PHPUNIT_COMPAT_RUNNER_VERSION, '8.0.0', '<') ) { |
129
|
|
|
require_once __DIR__ . '/AbstractTestCase7.php'; |
130
|
|
|
} |
131
|
|
|
else { |
132
|
|
|
require_once __DIR__ . '/AbstractTestCase8.php'; |
133
|
|
|
} |
134
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths