22
33namespace MyBuilder \PhpunitAccelerator ;
44
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
612{
713 private $ ignorePolicy ;
814
@@ -13,7 +19,7 @@ public function __construct(IgnoreTestPolicy $ignorePolicy = null)
1319 $ this ->ignorePolicy = ($ ignorePolicy ) ?: new NeverIgnoreTestPolicy ();
1420 }
1521
16- public function endTest (\PHPUnit_Framework_Test $ test , $ time )
22+ public function endTest (\PHPUnit \ Framework \ Test $ test , $ time )
1723 {
1824 $ testReflection = new \ReflectionObject ($ test );
1925
@@ -24,7 +30,7 @@ public function endTest(\PHPUnit_Framework_Test $test, $time)
2430 $ this ->safelyFreeProperties ($ test , $ testReflection ->getProperties ());
2531 }
2632
27- private function safelyFreeProperties (\PHPUnit_Framework_Test $ test , array $ properties )
33+ private function safelyFreeProperties (\PHPUnit \ Framework \ Test $ test , array $ properties )
2834 {
2935 foreach ($ properties as $ property ) {
3036 if ($ this ->isSafeToFreeProperty ($ property )) {
@@ -43,29 +49,11 @@ private function isNotPhpUnitProperty(\ReflectionProperty $property)
4349 return 0 !== strpos ($ property ->getDeclaringClass ()->getName (), self ::PHPUNIT_PROPERTY_PREFIX );
4450 }
4551
46- private function freeProperty (\PHPUnit_Framework_Test $ test , \ReflectionProperty $ property )
52+ private function freeProperty (\PHPUnit \ Framework \ Test $ test , \ReflectionProperty $ property )
4753 {
4854 $ property ->setAccessible (true );
4955 $ property ->setValue ($ test , null );
5056 }
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 ) {}
6957}
7058
7159class NeverIgnoreTestPolicy implements IgnoreTestPolicy
0 commit comments