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
|
|
|
/** |
41
|
|
|
* This method is called when a test method did not execute successfully. |
42
|
|
|
* |
43
|
|
|
* @param \Exception $e Exception. |
44
|
|
|
* |
45
|
|
|
* @return void |
46
|
|
|
*/ |
47
|
|
|
abstract protected function onNotSuccessfulTestCompatibilized(\Exception $e); |
48
|
|
|
|
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
else { |
52
|
|
|
/** |
53
|
|
|
* Implementation for PHPUnit 4 |
54
|
|
|
* |
55
|
|
|
* @internal |
56
|
|
|
*/ |
57
|
|
|
abstract class AbstractPHPUnitCompatibilityTestCase extends \PHPUnit_Framework_TestCase |
58
|
|
|
{ |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* This method is called when a test method did not execute successfully. |
62
|
|
|
* |
63
|
|
|
* @param \Exception $e Exception. |
64
|
|
|
* |
65
|
|
|
* @return void |
66
|
|
|
*/ |
67
|
|
|
protected function onNotSuccessfulTest(\Exception $e) |
68
|
|
|
{ |
69
|
|
|
$this->onNotSuccessfulTestCompatibilized($e); |
70
|
|
|
|
71
|
|
|
parent::onNotSuccessfulTest($e); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* This method is called when a test method did not execute successfully. |
76
|
|
|
* |
77
|
|
|
* @param \Exception $e Exception. |
78
|
|
|
* |
79
|
|
|
* @return void |
80
|
|
|
*/ |
81
|
|
|
abstract protected function onNotSuccessfulTestCompatibilized(\Exception $e); |
82
|
|
|
|
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|