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
|
|
|
if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { |
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Implementation for PHPUnit 5+ |
16
|
|
|
* |
17
|
|
|
* This code should be moved back to aik099\PHPUnit\BrowserTestCase when dropping support for |
18
|
|
|
* PHP 5.5 and older, as PHPUnit 4 won't be needed anymore. |
19
|
|
|
* |
20
|
|
|
* @internal |
21
|
|
|
*/ |
22
|
|
|
abstract class PHPUnitCompatibilityTestCase extends \PHPUnit_Framework_TestCase |
|
|
|
|
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* This method is called when a test method did not execute successfully. |
26
|
|
|
* |
27
|
|
|
* @param \Exception $e Exception. |
28
|
|
|
* |
29
|
|
|
* @return void |
30
|
|
|
*/ |
31
|
|
|
protected function onNotSuccessfulTest($e) |
|
|
|
|
32
|
|
|
{ |
33
|
|
|
$this->onNotSuccessfulTestCompatibilized($e); |
34
|
|
|
|
35
|
|
|
parent::onNotSuccessfulTest($e); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
abstract protected function onNotSuccessfulTestCompatibilized($e); |
|
|
|
|
39
|
|
|
} |
|
|
|
|
40
|
|
|
} else { |
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Implementation for PHPUnit 4 |
43
|
|
|
* |
44
|
|
|
* @internal |
45
|
|
|
*/ |
46
|
|
|
abstract class PHPUnitCompatibilityTestCase extends \PHPUnit_Framework_TestCase |
|
|
|
|
47
|
|
|
{ |
48
|
|
|
/** |
49
|
|
|
* This method is called when a test method did not execute successfully. |
50
|
|
|
* |
51
|
|
|
* @param \Exception $e Exception. |
52
|
|
|
* |
53
|
|
|
* @return void |
54
|
|
|
*/ |
55
|
|
|
protected function onNotSuccessfulTest(\Exception $e) |
|
|
|
|
56
|
|
|
{ |
57
|
|
|
$this->onNotSuccessfulTestCompatibilized($e); |
58
|
|
|
|
59
|
|
|
parent::onNotSuccessfulTest($e); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
abstract protected function onNotSuccessfulTestCompatibilized($e); |
|
|
|
|
63
|
|
|
} |
|
|
|
|
64
|
|
|
} |