fix issue #19: Failed test with PgSQL < 9.3
[m6w6/ext-pq] / tests / persistent001.phpt
1 --TEST--
2 persistent handles
3 --SKIPIF--
4 <?php include "_skipif.inc"; ?>
5 --FILE--
6 <?php
7 echo "Test\n";
8
9 include "_setup.inc";
10
11 for ($i=0; $i<100; ++$i) {
12 $c = new pq\Connection(PQ_DSN, pq\Connection::PERSISTENT);
13
14 if ($i % 2) {
15 $t = new pq\Transaction($c);
16 $c->listen("chan", function($chan, $msg) {
17 // dummy
18 });
19 $c->on(pq\Connection::EVENT_RESULT, function($c, $res) {
20 });
21 }
22
23 if (!($i%10)) gc_collect_cycles();
24
25 $c->exec("");
26 }
27 var_dump(raphf\stat_persistent_handles()->{"pq\\Connection"});
28 ?>
29 DONE
30 --EXPECTF--
31 Test
32 array(1) {
33 ["%S"]=>
34 array(2) {
35 ["used"]=>
36 int(1)
37 ["free"]=>
38 int(2)
39 }
40 }
41 DONE