prepareAsync++, Statement::execAsync++
[m6w6/ext-pq] / tests / notify001.phpt
1 --TEST--
2 notify
3 --SKIPIF--
4 <?php include "_skipif.inc"; ?>
5 --FILE--
6 <?php
7 echo "Test\n";
8
9 include "_setup.inc";
10
11 $consumer = new pq\Connection(PQ_DSN);
12 $consumer->listen("test", function($channel, $message, $pid) {
13 printf("%s(%d): %s\n", $channel, $pid, $message);
14 });
15
16 $producer = new pq\Connection(PQ_DSN);
17 $producer->notify("test", "this is a test");
18
19 $consumer->exec("select 1");
20
21 $producer->notify("test", "this is an async test");
22
23 $r = array($consumer->socket);
24 $w = null; $e = null;
25 var_dump(stream_select($r, $w, $e, NULL));
26 $consumer->poll();
27
28 var_dump(stream_select($r, $w, $e, 0));
29 $consumer->poll();
30 ?>
31 DONE
32 --EXPECTF--
33 Test
34 test(%d): this is a test
35 int(1)
36 test(%d): this is an async test
37 int(0)
38 DONE