travis: PHP-7.2+ debug builds require valgrind headers for PCRE
[m6w6/ext-pq] / tests / async002.phpt
1 --TEST--
2 async reset
3 --SKIPIF--
4 <?php include "_skipif.inc"; ?>
5 --FILE--
6 <?php
7 echo "Test\n";
8
9 include "_setup.inc";
10
11 $c = new pq\Connection(PQ_DSN, true);
12
13 function complete($c) {
14 $s = array($c->status);
15 echo "W";
16 $w = array($c->socket);
17 $r = $e = null;
18 stream_select($r, $w, $e, null);
19 while (true) {
20 $s[] = $c->status;
21 echo "P";
22 switch ($c->poll()) {
23 case pq\Connection::POLLING_READING:
24 echo "R";
25 $w = $e = null;
26 $r = array($c->socket);
27 stream_select($r, $w, $e, NULL);
28 break;
29 case pq\Connection::POLLING_WRITING:
30 echo "W";
31 $w = array($c->socket);
32 $r = $e = null;
33 stream_select($r, $w, $e, null);
34 break;
35 case pq\Connection::POLLING_FAILED:
36 echo "F";
37 break 2;
38 case pq\Connection::POLLING_OK:
39 echo "S";
40 break 2;
41 }
42 }
43 $s[] = $c->status;
44 printf("\n%s\n", implode(",", $s));
45 }
46
47 complete($c);
48
49 if ($c->status == pq\Connection::OK) {
50 $c->resetAsync();
51 complete($c);
52 }
53 ?>
54 DONE
55 --EXPECTREGEX--
56 Test
57 (WP(RP)*)+S
58 2(,\d)*,0
59 (WP(RP)*)+S
60 2(,\d)*,0
61 DONE