- add pers. handles test
authorMichael Wallner <mike@php.net>
Wed, 7 Feb 2007 16:10:39 +0000 (16:10 +0000)
committerMichael Wallner <mike@php.net>
Wed, 7 Feb 2007 16:10:39 +0000 (16:10 +0000)
tests/persistent_handles_001.phpt [new file with mode: 0644]

diff --git a/tests/persistent_handles_001.phpt b/tests/persistent_handles_001.phpt
new file mode 100644 (file)
index 0000000..f5a6309
--- /dev/null
@@ -0,0 +1,67 @@
+--TEST--
+persistent handles
+--SKIPIF--
+<?php
+include 'skip.inc';
+skipif(!defined("HTTP_SUPPORT_PERSISTENCE") || !http_support(HTTP_SUPPORT_PERSISTENCE), "need persistent handle support");
+?>
+--INI--
+http.persistent.handles.ident=GLOBAL
+--FILE--
+<?php
+echo "-TEST\n";
+
+echo "No free handles:\n";
+var_dump(http_persistent_handles_count());
+http_get("http://www.google.com/", null, $info[]);
+echo "One free request handle within GLOBAL:\n";
+var_dump(http_persistent_handles_count()->http_request["GLOBAL"]);
+echo "Reusing request handle:\n";
+http_get("http://www.google.com/", null, $info[]);
+var_dump($info[0]["pretransfer_time"] > 100 * $info[1]["pretransfer_time"], $info[0]["pretransfer_time"], $info[1]["pretransfer_time"]);
+echo "Handles' been cleaned up:\n";
+#http_persistent_handles_clean();
+var_dump(http_persistent_handles_count());
+echo "Done\n";
+?>
+--EXPECTF--
+%sTEST
+No free handles:
+object(stdClass)#%d (%d) {
+  ["http_request_pool"]=>
+  array(0) {
+  }
+  ["http_request"]=>
+  array(0) {
+  }
+  ["http_request_datashare"]=>
+  array(0) {
+  }
+  ["http_request_datashare_lock"]=>
+  array(0) {
+  }
+}
+One free request handle within GLOBAL:
+int(1)
+Reusing request handle:
+bool(true)
+float(%f)
+float(%f)
+Handles' been cleaned up:
+object(stdClass)#%d (%d) {
+  ["http_request_pool"]=>
+  array(0) {
+  }
+  ["http_request"]=>
+  array(1) {
+    ["GLOBAL"]=>
+    int(1)
+  }
+  ["http_request_datashare"]=>
+  array(0) {
+  }
+  ["http_request_datashare_lock"]=>
+  array(0) {
+  }
+}
+Done