- fix write access of HttpMessage headers array in inherited context
[m6w6/ext-http] / tests / HttpRequestPool_001.phpt
index d68330f888383d4c211b1fdbbf1d4ff01033504e..0b276b8b7c23e66d9dcb4aff75f6499ece8bba32 100644 (file)
@@ -3,36 +3,28 @@ HttpRequestPool
 --SKIPIF--
 <?php
 include 'skip.inc';
-(5 > (int) PHP_VERSION) and die('skip PHP5 is required for Http classes');
+checkver(5);
+checkurl('www.php.net');
+checkurl('pear.php.net');
+checkurl('pecl.php.net');
 ?>
 --FILE--
 <?php
-$urls = array(
-    'http://www.php.net',
-    'http://pear.php.net',
-    'http://pecl.php.net'
+$pool = new HttpRequestPool(
+    new HttpRequest('http://www.php.net/', HTTP_HEAD),
+    new HttpRequest('http://pear.php.net/', HTTP_HEAD),
+    new HttpRequest('http://pecl.php.net/', HTTP_HEAD)
 );
-$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'), '=', 
+foreach ($pool as $req) {
+    echo $req->getUrl(), '=',
         $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
+%shttp://www.php.net/=200:200
 http://pear.php.net/=200:200
 http://pecl.php.net/=200:200
 Done