isRequested()); delay(20); self::assertTrue($token->isRequested()); try { $token->throwIfRequested(); } catch (CancelledException $exception) { self::assertInstanceOf(TimeoutException::class, $exception->getPrevious()); $message = $exception->getPrevious()->getMessage(); self::assertStringContainsString('TimeoutCancellationToken was created here', $message); self::assertStringContainsString('TimeoutCancellationTokenTest.php:' . $line, $message); } } public function testWatcherCancellation(): void { $token = new TimeoutCancellationToken(1); self::assertSame(1, Loop::getInfo()["delay"]["enabled"]); unset($token); self::assertSame(0, Loop::getInfo()["delay"]["enabled"]); } }