11
11
12
12
namespace Symfony \Bridge \PhpUnit ;
13
13
14
- use PHPUnit \Framework \BaseTestListener ;
15
14
use PHPUnit \Framework \Test ;
15
+ use PHPUnit \Framework \TestListener ;
16
+ use PHPUnit \Framework \TestListenerDefaultImplementation ;
16
17
use PHPUnit \Framework \TestSuite ;
17
18
use PHPUnit \Framework \Warning ;
18
19
19
- if (class_exists ('PHPUnit_Runner_Version ' ) && version_compare (\PHPUnit_Runner_Version::id (), '6.0.0 ' , '< ' )) {
20
- class_alias ('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener ' , 'Symfony\Bridge\PhpUnit\SymfonyTestsListener ' );
21
20
// Using an early return instead of a else does not work when using the PHPUnit phar due to some weird PHP behavior (the class
22
21
// gets defined without executing the code before it and so the definition is not properly conditional)
22
+ if (class_exists ('PHPUnit_Runner_Version ' ) && version_compare (\PHPUnit_Runner_Version::id (), '6.0.0 ' , '< ' )) {
23
+ class_alias ('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener ' , 'Symfony\Bridge\PhpUnit\SymfonyTestsListener ' );
24
+ } elseif (version_compare (\PHPUnit \Runner \Version::id (), '7.0.0 ' , '< ' )) {
25
+ class_alias ('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerPhpunit6 ' , 'Symfony\Bridge\PhpUnit\SymfonyTestsListener ' );
23
26
} else {
24
27
/**
25
28
* Collects and replays skipped tests.
@@ -28,8 +31,10 @@ class_alias('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener', 'Symfony\Bridg
28
31
*
29
32
* @final
30
33
*/
31
- class SymfonyTestsListener extends BaseTestListener
34
+ class SymfonyTestsListener implements TestListener
32
35
{
36
+ use TestListenerDefaultImplementation;
37
+
33
38
private $ trait ;
34
39
35
40
public function __construct (array $ mockedNamespaces = array ())
@@ -42,29 +47,29 @@ public function globalListenerDisabled()
42
47
$ this ->trait ->globalListenerDisabled ();
43
48
}
44
49
45
- public function startTestSuite (TestSuite $ suite )
50
+ public function startTestSuite (TestSuite $ suite ): void
46
51
{
47
- return $ this ->trait ->startTestSuite ($ suite );
52
+ $ this ->trait ->startTestSuite ($ suite );
48
53
}
49
54
50
- public function addSkippedTest (Test $ test , \Exception $ e , $ time )
55
+ public function addSkippedTest (Test $ test , \Throwable $ t , float $ time ): void
51
56
{
52
- return $ this ->trait ->addSkippedTest ($ test , $ e , $ time );
57
+ $ this ->trait ->addSkippedTest ($ test , $ t , $ time );
53
58
}
54
59
55
- public function startTest (Test $ test )
60
+ public function startTest (Test $ test ): void
56
61
{
57
- return $ this ->trait ->startTest ($ test );
62
+ $ this ->trait ->startTest ($ test );
58
63
}
59
64
60
- public function addWarning (Test $ test , Warning $ e , $ time )
65
+ public function addWarning (Test $ test , Warning $ e , float $ time ): void
61
66
{
62
- return $ this ->trait ->addWarning ($ test , $ e , $ time );
67
+ $ this ->trait ->addWarning ($ test , $ e , $ time );
63
68
}
64
69
65
- public function endTest (Test $ test , $ time )
70
+ public function endTest (Test $ test , float $ time ): void
66
71
{
67
- return $ this ->trait ->endTest ($ test , $ time );
72
+ $ this ->trait ->endTest ($ test , $ time );
68
73
}
69
74
}
70
75
}
0 commit comments