Failed Conditions
Pull Request — master (#89)
by
unknown
02:08
created

onNotSuccessfulTestCompatibilized()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 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 aik099\PHPUnit;
12
13
14
if ( version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=') ) {
15
	/**
16
	 * Implementation for PHPUnit 5+
17
	 *
18
	 * This code should be moved back to aik099\PHPUnit\BrowserTestCase when dropping support for
19
	 * PHP 5.5 and older, as PHPUnit 4 won't be needed anymore.
20
	 *
21
	 * @internal
22
	 */
23
	abstract class AbstractPHPUnitCompatibilityTestCase extends \PHPUnit_Framework_TestCase
24
	{
25
26
		/**
27
		 * This method is called when a test method did not execute successfully.
28
		 *
29
		 * @param \Exception $e Exception.
30
		 *
31
		 * @return void
32
		 */
33
		protected function onNotSuccessfulTest($e)
34
		{
35
			$this->onNotSuccessfulTestCompatibilized($e);
36
37
			parent::onNotSuccessfulTest($e);
38
		}
39
40
		abstract protected function onNotSuccessfulTestCompatibilized($e);
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
41
42
	}
2 ignored issues
show
introduced by
Expected 0 spaces before closing brace; 4 found
Loading history...
introduced by
Closing brace of a class must be followed by a single blank line; found 0
Loading history...
43
}
44
else {
45
	/**
46
	 * Implementation for PHPUnit 4
47
	 *
48
	 * @internal
49
	 */
50
	abstract class AbstractPHPUnitCompatibilityTestCase extends \PHPUnit_Framework_TestCase
2 ignored issues
show
Comprehensibility Best Practice introduced by
The type aik099\PHPUnit\AbstractP...itCompatibilityTestCase has been defined more than once; this definition is ignored, only the first definition in this file (L23-42) is considered.

This check looks for classes that have been defined more than once in the same file.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
Coding Style introduced by
Only one class is allowed in a file
Loading history...
51
	{
52
53
		/**
54
		 * This method is called when a test method did not execute successfully.
55
		 *
56
		 * @param \Exception $e Exception.
57
		 *
58
		 * @return void
59
		 */
60
		protected function onNotSuccessfulTest(\Exception $e)
61
		{
62
			$this->onNotSuccessfulTestCompatibilized($e);
63
64
			parent::onNotSuccessfulTest($e);
65
		}
66
67
		abstract protected function onNotSuccessfulTestCompatibilized($e);
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
68
69
	}
2 ignored issues
show
introduced by
Expected 0 spaces before closing brace; 4 found
Loading history...
introduced by
Closing brace of a class must be followed by a single blank line; found 0
Loading history...
70
}
71