Failed Conditions
Push — master ( ec8608...c27b6f )
by Alexander
06:13
created

TAbstractTestCaseBody::onNotSuccessfulTestCompat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 2
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Runner\Version 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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)
0 ignored issues
show
Unused Code introduced by
The parameter $e is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

112
	protected function onNotSuccessfulTestCompat(/** @scrutinizer ignore-unused */ $e)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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