X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2FHttpRequestPool_001.phpt;h=4008e500daede6095faeee3e99a182af93d44a82;hp=3eecd11acbb15fcbdee7dc0dd1b0a6b396eb59fc;hb=6c4a552c1ad7b0018afb57a3d0028c2be166a30a;hpb=4a1c5914eccd82e0936f35f0804a9e35ed632f83 diff --git a/tests/HttpRequestPool_001.phpt b/tests/HttpRequestPool_001.phpt index 3eecd11..4008e50 100644 --- a/tests/HttpRequestPool_001.phpt +++ b/tests/HttpRequestPool_001.phpt @@ -3,48 +3,49 @@ HttpRequestPool --SKIPIF-- --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->detach($req); - $pool->attach($req); - $pool->detach($req); - $pool->attach($req); - $pool->detach($req); - $pool->attach($req); - $req->getResponseMessage()->getResponseCode(); - $req->getResponseMessage()->getResponseCode(); - $req->getResponseMessage()->getResponseCode(); - $req->getResponseMessage()->getResponseCode(); } -$pool->send(); -$pool->reset(); -$pool->attach($req); + +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-- +%sTEST 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