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
|
|
|
if ( \class_exists('\PHPUnit_Framework_IncompleteTestError') ) { |
17
|
|
|
\class_alias( |
18
|
|
|
'\PHPUnit_Framework_IncompleteTestError', |
19
|
|
|
'\ConsoleHelpers\PHPUnitCompat\Framework\IncompleteTestError' |
20
|
|
|
); |
21
|
|
|
} |
22
|
|
|
else { |
23
|
|
|
\class_alias( |
24
|
|
|
'\PHPUnit\Framework\IncompleteTestError', |
25
|
|
|
'\ConsoleHelpers\PHPUnitCompat\Framework\IncompleteTestError' |
26
|
|
|
); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
if ( class_exists('\PHPUnit_Framework_SkippedTestError') ) { |
30
|
|
|
\class_alias('\PHPUnit_Framework_SkippedTestError', '\ConsoleHelpers\PHPUnitCompat\Framework\SkippedTestError'); |
31
|
|
|
} |
32
|
|
|
else { |
33
|
|
|
\class_alias('\PHPUnit\Framework\SkippedTestError', '\ConsoleHelpers\PHPUnitCompat\Framework\SkippedTestError'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
if ( class_exists('\PHPUnit_Framework_TestSuite_DataProvider') ) { |
37
|
|
|
\class_alias( |
38
|
|
|
'\PHPUnit_Framework_TestSuite_DataProvider', |
39
|
|
|
'\ConsoleHelpers\PHPUnitCompat\Framework\DataProviderTestSuite' |
40
|
|
|
); |
41
|
|
|
} |
42
|
|
|
else { |
43
|
|
|
\class_alias( |
44
|
|
|
'\PHPUnit\Framework\DataProviderTestSuite', |
45
|
|
|
'\ConsoleHelpers\PHPUnitCompat\Framework\DataProviderTestSuite' |
46
|
|
|
); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
if ( class_exists('\PHPUnit_Framework_TestResult') ) { |
50
|
|
|
\class_alias('\PHPUnit_Framework_TestResult', '\ConsoleHelpers\PHPUnitCompat\Framework\TestResult'); |
51
|
|
|
} |
52
|
|
|
else { |
53
|
|
|
\class_alias('\PHPUnit\Framework\TestResult', '\ConsoleHelpers\PHPUnitCompat\Framework\TestResult'); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
if ( class_exists('\PHPUnit_Framework_Test') ) { |
57
|
|
|
\class_alias('\PHPUnit_Framework_Test', '\ConsoleHelpers\PHPUnitCompat\Framework\Test'); |
58
|
|
|
} |
59
|
|
|
else { |
60
|
|
|
\class_alias('\PHPUnit\Framework\Test', '\ConsoleHelpers\PHPUnitCompat\Framework\Test'); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
if ( class_exists('\PHP_CodeCoverage') ) { |
64
|
|
|
\class_alias('\PHP_CodeCoverage', '\aik099\SebastianBergmann\CodeCoverage\CodeCoverage'); |
65
|
|
|
} |
66
|
|
|
else { |
67
|
|
|
\class_alias( |
68
|
|
|
'\SebastianBergmann\CodeCoverage\CodeCoverage', |
69
|
|
|
'\aik099\SebastianBergmann\CodeCoverage\CodeCoverage' |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
if ( \interface_exists('\PHP_CodeCoverage_Driver') ) { |
74
|
|
|
\class_alias('\PHP_CodeCoverage_Driver', '\aik099\SebastianBergmann\CodeCoverage\Driver\Driver'); |
75
|
|
|
} |
76
|
|
|
else { |
77
|
|
|
\class_alias( |
78
|
|
|
'\SebastianBergmann\CodeCoverage\Driver\Driver', |
79
|
|
|
'\aik099\SebastianBergmann\CodeCoverage\Driver\Driver' |
80
|
|
|
); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
if ( class_exists('\PHP_CodeCoverage_Filter') ) { |
84
|
|
|
\class_alias('\PHP_CodeCoverage_Filter', '\aik099\SebastianBergmann\CodeCoverage\Filter'); |
85
|
|
|
} |
86
|
|
|
else { |
87
|
|
|
\class_alias('\SebastianBergmann\CodeCoverage\Filter', '\aik099\SebastianBergmann\CodeCoverage\Filter'); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
if ( !\defined('PHPUNIT_COMPAT_RUNNER_VERSION') ) { |
91
|
|
|
if ( \class_exists('PHPUnit\Runner\Version') ) { |
92
|
|
|
\define('PHPUNIT_COMPAT_RUNNER_VERSION', Version::id()); |
93
|
|
|
} |
94
|
|
|
else { |
95
|
|
|
\define('PHPUNIT_COMPAT_RUNNER_VERSION', \PHPUnit_Runner_Version::id()); |
|
|
|
|
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
|
100
|
|
|
trait TAbstractTestCaseBody |
101
|
|
|
{ |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* This method is called when a test method did not execute successfully. |
105
|
|
|
* |
106
|
|
|
* @param \Exception|\Throwable $e Exception. |
107
|
|
|
* |
108
|
|
|
* @return void |
109
|
|
|
*/ |
110
|
1 |
|
protected function onNotSuccessfulTestCompat($e) |
|
|
|
|
111
|
|
|
{ |
112
|
|
|
|
113
|
1 |
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @after |
117
|
|
|
* @codeCoverageIgnore |
118
|
|
|
* @internal |
119
|
|
|
*/ |
120
|
|
|
protected function verifyMockeryExpectations() |
121
|
|
|
{ |
122
|
|
|
if ( !\class_exists('Mockery') ) { |
123
|
|
|
return; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
// Add Mockery expectations to assertion count. |
127
|
|
|
$container = \Mockery::getContainer(); |
|
|
|
|
128
|
|
|
|
129
|
|
|
if ( $container !== null ) { |
130
|
|
|
$this->addToAssertionCount($container->mockery_getExpectationCount()); |
|
|
|
|
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
// Verify Mockery expectations. |
134
|
|
|
\Mockery::close(); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
if ( version_compare(\PHPUNIT_COMPAT_RUNNER_VERSION, '6.0.0', '<') ) { |
140
|
|
|
require_once __DIR__ . '/AbstractTestCase5.php'; |
141
|
|
|
} |
142
|
|
|
else { |
143
|
|
|
require_once __DIR__ . '/AbstractTestCase7.php'; |
144
|
|
|
} |
145
|
|
|
|
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