|
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 PHPUnitCompatibilityTestCase 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); |
|
|
|
|
|
|
41
|
|
|
|
|
42
|
|
|
} |
|
|
|
|
|
|
43
|
|
|
} |
|
44
|
|
|
else { |
|
45
|
|
|
/** |
|
46
|
|
|
* Implementation for PHPUnit 4 |
|
47
|
|
|
* |
|
48
|
|
|
* @internal |
|
49
|
|
|
*/ |
|
50
|
|
|
abstract class PHPUnitCompatibilityTestCase extends \PHPUnit_Framework_TestCase |
|
|
|
|
|
|
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); |
|
|
|
|
|
|
68
|
|
|
|
|
69
|
|
|
} |
|
|
|
|
|
|
70
|
|
|
} |
|
71
|
|
|
|