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