X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2FHttpRequest_002.phpt;h=ddb443425e259fdf8f9ce40a07274c701187bafc;hp=9c9c49ac80004e12629040d9f8c6e94a5793115c;hb=b562e34cf4f8c8fae7b8fe773e0eed71592b09c2;hpb=b2391aa3d1d4bf399b8b5586e9babc515955d96e diff --git a/tests/HttpRequest_002.phpt b/tests/HttpRequest_002.phpt index 9c9c49a..ddb4434 100644 --- a/tests/HttpRequest_002.phpt +++ b/tests/HttpRequest_002.phpt @@ -4,24 +4,31 @@ HttpRequest GET/POST --FILE-- send()); +$r->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_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 -bool(true) Array ( [effective_url] => http://www.google.com/ @@ -46,10 +53,28 @@ Array [content_length_upload] => %d [content_type] => %s [httpauth_avail] => %d - [proxyauth_avail] => %d - [num_connects] => %d + [proxyauth_avail] => %s +) +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(501) -int(501) -bool(true) +int(200) +Done