X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2FHttpRequestPool_001.phpt;h=4008e500daede6095faeee3e99a182af93d44a82;hp=9b98b749f21b62955945e5aa4ac7a803dc3dc553;hb=65cf6ca09489451473d9aba81f22895058403ca8;hpb=e3aa410bced63d6b75a285a856b2bf43a79dabea diff --git a/tests/HttpRequestPool_001.phpt b/tests/HttpRequestPool_001.phpt index 9b98b74..4008e50 100644 --- a/tests/HttpRequestPool_001.phpt +++ b/tests/HttpRequestPool_001.phpt @@ -3,35 +3,49 @@ HttpRequestPool --SKIPIF-- --FILE-- addPostFields(array('a'=>1,'b'=>2)) ; + $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), - $post = new HttpRequest('http://dev.iworks.at/.print_request.php', HTTP_POST) + new HttpRequest('http://www.php.net/', HTTP_METH_HEAD), + $post ); -$post->addPostFields(array('a'=>1,'b'=>2)) ; + $pool->send(); + foreach ($pool as $req) { echo $req->getUrl(), '=', $req->getResponseCode(), ':', $req->getResponseMessage()->getResponseCode(), "\n"; } + +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-- %sTEST http://www.php.net/=200:200 -http://pear.php.net/=200:200 -http://pecl.php.net/=200:200 -http://dev.iworks.at/.print_request.php=200:200 +http://dev.iworks.at/ext-http/.print_request.php=200:200 +. +. Done