xref: /php-uv/tests/100-uv_stop.phpt (revision 096eedc2)
1--TEST--
2Test uv_stop ends loop execution
3--FILE--
4<?php
5$loop = uv_default_loop();
6$timer = uv_timer_init();
7
8$i = 0;
9uv_timer_start($timer, 10, 10, function($timer) use (&$i, $loop) {
10    echo "count: {$i}" . PHP_EOL;
11    $i++;
12
13    if ($i > 3) {
14        uv_stop($loop);
15    }
16});
17
18uv_run();
19
20echo "finished" . PHP_EOL;
21--EXPECT--
22count: 0
23count: 1
24count: 2
25count: 3
26finished