Failed Conditions
Push — master ( db6d0c...694d4f )
by Alexander
27s queued 24s
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
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());
1 ignored issue
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...
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)
1 ignored issue
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

110
	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...
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();
1 ignored issue
show
Bug introduced by
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. 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...
128
129
		if ( $container !== null ) {
130
			$this->addToAssertionCount($container->mockery_getExpectationCount());
0 ignored issues
show
Bug introduced by
It seems like addToAssertionCount() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

130
			$this->/** @scrutinizer ignore-call */ 
131
          addToAssertionCount($container->mockery_getExpectationCount());
Loading history...
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