simple persistent connection test
[m6w6/ext-pq] / tests / persistent001.phpt
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