X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2FHttpRequestPool_001.phpt;h=f94e92f2d0b2803d19a15724fd82b7d9c2024f16;hp=3eecd11acbb15fcbdee7dc0dd1b0a6b396eb59fc;hb=99b27b9e44043e5ff1bd53f2a1e3b007cfd16a42;hpb=4a1c5914eccd82e0936f35f0804a9e35ed632f83 diff --git a/tests/HttpRequestPool_001.phpt b/tests/HttpRequestPool_001.phpt index 3eecd11..f94e92f 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-- +%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