@@ -37,14 +37,6 @@ final public function setName(string $name): void
37
37
$ this ->realTestName = $ name ;
38
38
}
39
39
40
- /**
41
- * Execute any needed cleanup after the test before loop watchers are checked.
42
- */
43
- protected function cleanup (): void
44
- {
45
- // Empty method in base class.
46
- }
47
-
48
40
protected function setUp (): void
49
41
{
50
42
$ this ->setUpInvoked = true ;
@@ -75,33 +67,29 @@ final protected function runAsyncTest(mixed ...$args): mixed
75
67
$ start = now ();
76
68
77
69
try {
78
- try {
79
- [, $ returnValue ] = all ([
80
- $ this ->deferredFuture ->getFuture (),
81
- async (function () use ($ args ): mixed {
82
- try {
83
- $ result = ([$ this , $ this ->realTestName ])(...$ args );
84
- if ($ result instanceof Future) {
85
- $ result = $ result ->await ();
86
- }
87
-
88
- // Force an extra tick of the event loop to ensure any uncaught exceptions are
89
- // forwarded to the event loop handler before the test ends.
90
- $ deferred = new DeferredFuture ();
91
- EventLoop::defer (static fn () => $ deferred ->complete ());
92
- $ deferred ->getFuture ()->await ();
93
-
94
- return $ result ;
95
- } finally {
96
- if (!$ this ->deferredFuture ->isComplete ()) {
97
- $ this ->deferredFuture ->complete ();
98
- }
70
+ [, $ returnValue ] = all ([
71
+ $ this ->deferredFuture ->getFuture (),
72
+ async (function () use ($ args ): mixed {
73
+ try {
74
+ $ result = ([$ this , $ this ->realTestName ])(...$ args );
75
+ if ($ result instanceof Future) {
76
+ $ result = $ result ->await ();
99
77
}
100
- }),
101
- ]);
102
- } finally {
103
- $ this ->cleanup ();
104
- }
78
+
79
+ // Force an extra tick of the event loop to ensure any uncaught exceptions are
80
+ // forwarded to the event loop handler before the test ends.
81
+ $ deferred = new DeferredFuture ();
82
+ EventLoop::defer (static fn () => $ deferred ->complete ());
83
+ $ deferred ->getFuture ()->await ();
84
+
85
+ return $ result ;
86
+ } finally {
87
+ if (!$ this ->deferredFuture ->isComplete ()) {
88
+ $ this ->deferredFuture ->complete ();
89
+ }
90
+ }
91
+ }),
92
+ ]);
105
93
} finally {
106
94
if (isset ($ this ->timeoutId )) {
107
95
EventLoop::cancel ($ this ->timeoutId );
0 commit comments