- request pool test
authorMichael Wallner <mike@php.net>
Mon, 13 Jun 2005 15:22:47 +0000 (15:22 +0000)
committerMichael Wallner <mike@php.net>
Mon, 13 Jun 2005 15:22:47 +0000 (15:22 +0000)
tests/HttpRequestPool_001.phpt [new file with mode: 0644]

diff --git a/tests/HttpRequestPool_001.phpt b/tests/HttpRequestPool_001.phpt
new file mode 100644 (file)
index 0000000..d68330f
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+HttpRequestPool
+--SKIPIF--
+<?php
+include 'skip.inc';
+(5 > (int) PHP_VERSION) and die('skip PHP5 is required for Http classes');
+?>
+--FILE--
+<?php
+$urls = array(
+    'http://www.php.net',
+    'http://pear.php.net',
+    'http://pecl.php.net'
+);
+$pool = new HttpRequestPool;
+foreach ($urls as $url) {
+    $pool->attach($reqs[] = new HttpRequest($url, HTTP_HEAD));
+}
+$pool->send();
+foreach ($reqs as $req) {
+    echo $req->getResponseInfo('effective_url'), '=', 
+        $req->getResponseCode(), ':',
+        $req->getResponseMessage()->getResponseCode(), "\n";
+    $pool->detach($req);
+    $pool->attach($req);
+}
+$pool->send();
+$pool->reset();
+echo "Done\n";
+?>
+--EXPECTF--
+Content-type: text/html
+X-Powered-By: PHP/%s
+
+http://www.php.net/=200:200
+http://pear.php.net/=200:200
+http://pecl.php.net/=200:200
+Done