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