1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 04:24:42 +01:00
amp/test/Loop/UvLoopDestructShutdown.phpt

33 lines
649 B
Plaintext
Raw Permalink Normal View History

--TEST--
Test order of destruction not interfering with access to UV handles
--SKIPIF--
<?php
\extension_loaded("uv") or die("SKIP: ext/uv required for this test");
?>
--FILE--
<?php
include __DIR__.'/../../vendor/autoload.php';
use Amp\Loop;
2017-05-16 20:08:27 +02:00
Loop::run(function () {
Loop::setState('test', new class {
private $handle;
2018-06-18 20:00:01 +02:00
public function __construct()
{
2017-05-16 20:08:27 +02:00
$this->handle = Loop::repeat(10, function () {});
}
2018-06-18 20:00:01 +02:00
public function __destruct()
{
2017-05-16 20:08:27 +02:00
Loop::cancel($this->handle);
print "ok";
}
});
Loop::delay(0, [Loop::class, "stop"]);
});
?>
--EXPECT--
ok