ext-uv/tests/100-uv_timer.phpt

29 lines
418 B
Plaintext
Raw Normal View History

2012-06-25 18:27:06 +02:00
--TEST--
Check for uv_timer_init and uv_timer_start
--FILE--
<?php
$loop = uv_default_loop();
$timer = uv_timer_init();
$i = 0;
2012-07-08 18:26:42 +02:00
uv_timer_start($timer, 10, 10, function($timer, $stat)
use (&$i) {
2012-06-25 18:27:06 +02:00
echo "count: {$i}" . PHP_EOL;
$i++;
if ($i > 3) {
uv_timer_stop($timer);
uv_unref($timer);
}
});
uv_run();
echo "finished";
--EXPECT--
count: 0
count: 1
count: 2
count: 3
finished