X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2FHttpRequestPool_001.phpt;h=f94e92f2d0b2803d19a15724fd82b7d9c2024f16;hp=d68330f888383d4c211b1fdbbf1d4ff01033504e;hb=99b27b9e44043e5ff1bd53f2a1e3b007cfd16a42;hpb=6a5ec2c676458f24e191801ee20bce02691138b6 diff --git a/tests/HttpRequestPool_001.phpt b/tests/HttpRequestPool_001.phpt index d68330f..f94e92f 100644 --- a/tests/HttpRequestPool_001.phpt +++ b/tests/HttpRequestPool_001.phpt @@ -3,36 +3,49 @@ HttpRequestPool --SKIPIF-- (int) PHP_VERSION) and die('skip PHP5 is required for Http classes'); +checkmin(5.3); +checkcls('HttpRequestPool'); +checkurl('www.php.net'); +checkurl('dev.iworks.at'); ?> --FILE-- addPostFields(array('a'=>1,'b'=>2)) ; + +$pool = new HttpRequestPool( + new HttpRequest('http://www.php.net/', HTTP_METH_HEAD), + $post ); -$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(); + +foreach ($pool as $req) { + try { + $pool->attach(new HttpRequest('http://foo.bar')); + } catch (HttpRequestPoolException $x) { + echo ".\n"; + } +} + +foreach ($pool as $req) { + $pool->detach($req); +} + echo "Done\n"; ?> ---EXPECTF-- -Content-type: text/html -X-Powered-By: PHP/%s +--EXPECTF-- +%aTEST http://www.php.net/=200:200 -http://pear.php.net/=200:200 -http://pecl.php.net/=200:200 +http://dev.iworks.at/ext-http/.print_request.php=200:200 +. +. Done