@@ -37,14 +37,6 @@ final public function setName(string $name): void
3737 $ this ->realTestName = $ name ;
3838 }
3939
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-
4840 protected function setUp (): void
4941 {
5042 $ this ->setUpInvoked = true ;
@@ -75,33 +67,29 @@ final protected function runAsyncTest(mixed ...$args): mixed
7567 $ start = now ();
7668
7769 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 ();
9977 }
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+ ]);
10593 } finally {
10694 if (isset ($ this ->timeoutId )) {
10795 EventLoop::cancel ($ this ->timeoutId );
0 commit comments