assertTrue($invoked); $this->assertSame($reason, $exception); } /** * @depends testRethrow */ public function testReactPromise(): void { $exception = new \Exception; $promise = reject($exception); Promise\rethrow($promise); $invoked = false; Loop::setErrorHandler(function (\Throwable $exception) use (&$invoked, &$reason): void { $invoked = true; $reason = $exception; }); delay(0); // Tick the event loop. $this->assertTrue($invoked); $this->assertSame($reason, $exception); } }