2
2
3
3
namespace MyBuilder \PhpunitAccelerator ;
4
4
5
- class TestListener implements \PHPUnit_Framework_TestListener
5
+ use PHPUnit \Framework \BaseTestListener ;
6
+
7
+ if (!interface_exists ('\PHPUnit\Framework\Test ' )) {
8
+ class_alias ('\PHPUnit_Framework_Test ' , '\PHPUnit\Framework\Test ' );
9
+ }
10
+
11
+ class TestListener extends BaseTestListener
6
12
{
7
13
private $ ignorePolicy ;
8
14
@@ -13,7 +19,7 @@ public function __construct(IgnoreTestPolicy $ignorePolicy = null)
13
19
$ this ->ignorePolicy = ($ ignorePolicy ) ?: new NeverIgnoreTestPolicy ();
14
20
}
15
21
16
- public function endTest (\PHPUnit_Framework_Test $ test , $ time )
22
+ public function endTest (\PHPUnit \ Framework \ Test $ test , $ time )
17
23
{
18
24
$ testReflection = new \ReflectionObject ($ test );
19
25
@@ -24,7 +30,7 @@ public function endTest(\PHPUnit_Framework_Test $test, $time)
24
30
$ this ->safelyFreeProperties ($ test , $ testReflection ->getProperties ());
25
31
}
26
32
27
- private function safelyFreeProperties (\PHPUnit_Framework_Test $ test , array $ properties )
33
+ private function safelyFreeProperties (\PHPUnit \ Framework \ Test $ test , array $ properties )
28
34
{
29
35
foreach ($ properties as $ property ) {
30
36
if ($ this ->isSafeToFreeProperty ($ property )) {
@@ -43,29 +49,11 @@ private function isNotPhpUnitProperty(\ReflectionProperty $property)
43
49
return 0 !== strpos ($ property ->getDeclaringClass ()->getName (), self ::PHPUNIT_PROPERTY_PREFIX );
44
50
}
45
51
46
- private function freeProperty (\PHPUnit_Framework_Test $ test , \ReflectionProperty $ property )
52
+ private function freeProperty (\PHPUnit \ Framework \ Test $ test , \ReflectionProperty $ property )
47
53
{
48
54
$ property ->setAccessible (true );
49
55
$ property ->setValue ($ test , null );
50
56
}
51
-
52
- public function startTestSuite (\PHPUnit_Framework_TestSuite $ suite ) {}
53
-
54
- public function addError (\PHPUnit_Framework_Test $ test , \Exception $ e , $ time ) {}
55
-
56
- public function addFailure (\PHPUnit_Framework_Test $ test , \PHPUnit_Framework_AssertionFailedError $ e , $ time ) {}
57
-
58
- public function addIncompleteTest (\PHPUnit_Framework_Test $ test , \Exception $ e , $ time ) {}
59
-
60
- public function addSkippedTest (\PHPUnit_Framework_Test $ test , \Exception $ e , $ time ) {}
61
-
62
- public function endTestSuite (\PHPUnit_Framework_TestSuite $ suite ) {}
63
-
64
- public function startTest (\PHPUnit_Framework_Test $ test ) {}
65
-
66
- public function addRiskyTest (\PHPUnit_Framework_Test $ test , \Exception $ e , $ time ) {}
67
-
68
- public function addWarning (\PHPUnit_Framework_Test $ test , \PHPUnit_Framework_Warning $ e , $ time ) {}
69
57
}
70
58
71
59
class NeverIgnoreTestPolicy implements IgnoreTestPolicy
0 commit comments