simple persistent connection test
authorMichael Wallner <mike@php.net>
Wed, 6 Feb 2013 21:04:19 +0000 (22:04 +0100)
committerMichael Wallner <mike@php.net>
Wed, 6 Feb 2013 21:04:19 +0000 (22:04 +0100)
tests/persistent001.phpt [new file with mode: 0644]

diff --git a/tests/persistent001.phpt b/tests/persistent001.phpt
new file mode 100644 (file)
index 0000000..b2c72c3
--- /dev/null
@@ -0,0 +1,34 @@
+--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);
+       }
+
+       $c->exec("");
+}
+var_dump(raphf\stat_persistent_handles()->{"pq\\Connection"});
+?>
+DONE
+--EXPECTF--
+Test
+array(1) {
+  ["%s"]=>
+  array(2) {
+    ["used"]=>
+    int(1)
+    ["free"]=>
+    int(2)
+  }
+}
+DONE