X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2FHttpRequestPool_006.phpt;h=1b5cb9f14269c6c0e2017a79b9de0bb720be483a;hp=9d788ad2ada97592ac8a323eb2834c969b8ac8b9;hb=6c4a552c1ad7b0018afb57a3d0028c2be166a30a;hpb=9b6cff9fb09a6a49d75439b03201f8e6c8995e22 diff --git a/tests/HttpRequestPool_006.phpt b/tests/HttpRequestPool_006.phpt index 9d788ad..1b5cb9f 100644 --- a/tests/HttpRequestPool_006.phpt +++ b/tests/HttpRequestPool_006.phpt @@ -10,23 +10,41 @@ checkurl("de.php.net"); --FILE-- detach($this); + static $i = array(); + if (empty($i[$this->getUrl()])) { + $i[$this->getUrl()] = true; + try { + $GLOBALS['p']->detach($this); + } catch (Exception $ex) { + echo $ex, "\n"; + } + } } -} -class r2 extends HttpRequest { function onFinish() { $GLOBALS['p']->detach($this); } } -$p = new HttpRequestPool(new r1("at.php.net"), new r2("de.php.net")); +$p = new HttpRequestPool(new r("http://at.php.net"), new r("http://de.php.net")); $p->send(); var_dump($p->getAttachedRequests()); echo "Done\n"; ?> --EXPECTF-- %sTEST +exception 'HttpRequestPoolException' with message 'HttpRequest object(#%d) cannot be detached from the HttpRequestPool while executing the progress callback' in %sHttpRequestPool_006.php:%d +Stack trace: +#0 %sHttpRequestPool_006.php(%d): HttpRequestPool->detach(Object(r)) +#1 [internal function]: r->onProgress(Array) +#2 %sHttpRequestPool_006.php(%d): HttpRequestPool->send() +#3 {main} +exception 'HttpRequestPoolException' with message 'HttpRequest object(#%d) cannot be detached from the HttpRequestPool while executing the progress callback' in %sHttpRequestPool_006.php:%d +Stack trace: +#0 %sHttpRequestPool_006.php(%d): HttpRequestPool->detach(Object(r)) +#1 [internal function]: r->onProgress(Array) +#2 %sHttpRequestPool_006.php(%d): HttpRequestPool->send() +#3 {main} array(0) { } Done