2013-02-06 22:04:19 +01:00
|
|
|
--TEST--
|
|
|
|
persistent handles
|
|
|
|
--SKIPIF--
|
|
|
|
<?php include "_skipif.inc"; ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
echo "Test\n";
|
|
|
|
|
|
|
|
include "_setup.inc";
|
|
|
|
|
|
|
|
for ($i=0; $i<100; ++$i) {
|
|
|
|
$c = new pq\Connection(PQ_DSN, pq\Connection::PERSISTENT);
|
|
|
|
|
|
|
|
if ($i % 2) {
|
|
|
|
$t = new pq\Transaction($c);
|
2013-02-14 14:54:22 +01:00
|
|
|
$c->listen("chan", function($chan, $msg) {
|
|
|
|
// dummy
|
|
|
|
});
|
2013-02-21 13:18:06 +01:00
|
|
|
$c->on(pq\Connection::EVENT_RESULT, function($c, $res) {
|
2013-02-14 14:54:22 +01:00
|
|
|
});
|
2013-02-06 22:04:19 +01:00
|
|
|
}
|
2013-02-14 14:54:22 +01:00
|
|
|
|
|
|
|
if (!($i%10)) gc_collect_cycles();
|
2013-02-06 22:04:19 +01:00
|
|
|
|
|
|
|
$c->exec("");
|
|
|
|
}
|
|
|
|
var_dump(raphf\stat_persistent_handles()->{"pq\\Connection"});
|
|
|
|
?>
|
|
|
|
DONE
|
|
|
|
--EXPECTF--
|
|
|
|
Test
|
|
|
|
array(1) {
|
2013-02-14 14:54:22 +01:00
|
|
|
["%S"]=>
|
2013-02-06 22:04:19 +01:00
|
|
|
array(2) {
|
|
|
|
["used"]=>
|
|
|
|
int(1)
|
|
|
|
["free"]=>
|
|
|
|
int(2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DONE
|