X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2FHttpRequest_002.phpt;h=a5569773a6b10571cb03a7db423160243db6115f;hp=349f1faf38c752e4970fda9c31e7748dfa4493c6;hb=d650022122969644c33bd03a552af1a631429e16;hpb=f045f8949f2deb94530b7bca18f85aaa8d5c7d58 diff --git a/tests/HttpRequest_002.phpt b/tests/HttpRequest_002.phpt index 349f1fa..a556977 100644 --- a/tests/HttpRequest_002.phpt +++ b/tests/HttpRequest_002.phpt @@ -3,22 +3,29 @@ HttpRequest GET/POST --SKIPIF-- --FILE-- send(); print_r($r->getResponseInfo()); -$r->setMethod(HTTP_POST); -$r->addPostFields(array('q'=>'foobar','start'=>10)); + +$r = new HttpRequest('http://dev.iworks.at/.print_request.php', HTTP_METH_POST); +$r->addCookies(array('MyCookie' => 'foobar')); +$r->addQueryData(array('gq'=>'foobar','gi'=>10)); +$r->addPostFields(array('pq'=>'foobar','pi'=>10)); +$r->addPostFile('upload', dirname(__FILE__).'/data.txt', 'text/plain'); $r->send(); -var_dump($r->getResponseCode()); +echo $r->getResponseBody(); var_dump($r->getResponseMessage()->getResponseCode()); -var_dump(false != strstr($r->getResponseBody(), "Not Implemented")); + +echo "Done"; ?> --EXPECTF-- %sTEST @@ -26,7 +33,7 @@ Array ( [effective_url] => http://www.google.com/ [response_code] => %d - [http_connectcode] => %d + [connect_code] => %d [filetime] => %s [total_time] => %f [namelookup_time] => %f @@ -42,13 +49,36 @@ Array [header_size] => %d [request_size] => %d [ssl_verifyresult] => %d + [ssl_engines] => Array%s [content_length_download] => %d [content_length_upload] => %d [content_type] => %s [httpauth_avail] => %d [proxyauth_avail] => %s + [num_connects] => %d + [cookies] => Array%s + [os_errno] => 0 + [error] => ) -int(501) -int(501) -bool(true) +Array +( + [gq] => foobar + [gi] => 10 + [pq] => foobar + [pi] => 10 + [MyCookie] => foobar +) +Array +( + [upload] => Array + ( + [name] => data.txt + [type] => text/plain + [tmp_name] => %s + [error] => 0 + [size] => 1010 + ) +) +int(200) +Done