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 ( \class_exists('PHPUnit\Runner\Version') ) { |
||
91 | $runner_version = Version::id(); |
||
92 | } |
||
93 | else { |
||
94 | $runner_version = \PHPUnit_Runner_Version::id(); |
||
95 | } |
||
96 | |||
97 | |||
98 | trait TAbstractTestCaseBody |
||
99 | { |
||
100 | |||
101 | /** |
||
102 | * This method is called when a test method did not execute successfully. |
||
103 | * |
||
104 | * @param \Exception|\Throwable $e Exception. |
||
105 | * |
||
106 | * @return void |
||
107 | */ |
||
108 | 1 | protected function onNotSuccessfulTestCompat($e) |
|
1 ignored issue
–
show
|
|||
109 | { |
||
110 | |||
111 | 1 | } |
|
112 | |||
113 | /** |
||
114 | * @after |
||
115 | * @codeCoverageIgnore |
||
116 | * @internal |
||
117 | */ |
||
118 | protected function verifyMockeryExpectations() |
||
119 | { |
||
120 | if ( !\class_exists('Mockery') ) { |
||
121 | return; |
||
122 | } |
||
123 | |||
124 | // Add Mockery expectations to assertion count. |
||
125 | $container = \Mockery::getContainer(); |
||
1 ignored issue
–
show
The type
Mockery was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
126 | |||
127 | if ( $container !== null ) { |
||
128 | $this->addToAssertionCount($container->mockery_getExpectationCount()); |
||
129 | } |
||
130 | |||
131 | // Verify Mockery expectations. |
||
132 | \Mockery::close(); |
||
133 | } |
||
134 | |||
135 | } |
||
136 | |||
137 | if ( version_compare($runner_version, '6.0.0', '<') ) { |
||
138 | require_once __DIR__ . '/AbstractTestCase5.php'; |
||
139 | } |
||
140 | else { |
||
141 | require_once __DIR__ . '/AbstractTestCase7.php'; |
||
142 | } |
||
143 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.