summaryrefslogtreecommitdiff
path: root/_test/tests/inc/httpclient_http.test.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-04-20 23:11:53 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-04-20 23:11:53 +0200
commitf7161c34cbd45d87124ad25cf06d3ff57e3bc23f (patch)
tree0aea3c274dfbf98babab7dffdbe32d3bea602087 /_test/tests/inc/httpclient_http.test.php
parente37739ccaac4a28aa2176487a637cbdf3d1b85a0 (diff)
downloadrpg-f7161c34cbd45d87124ad25cf06d3ff57e3bc23f.tar.gz
rpg-f7161c34cbd45d87124ad25cf06d3ff57e3bc23f.tar.bz2
reenabled romanization test
The test can be skipped by excluding the "slow" group.
Diffstat (limited to '_test/tests/inc/httpclient_http.test.php')
-rw-r--r--_test/tests/inc/httpclient_http.test.php45
1 files changed, 42 insertions, 3 deletions
diff --git a/_test/tests/inc/httpclient_http.test.php b/_test/tests/inc/httpclient_http.test.php
index 3857273f7..9cae3736a 100644
--- a/_test/tests/inc/httpclient_http.test.php
+++ b/_test/tests/inc/httpclient_http.test.php
@@ -1,11 +1,11 @@
<?php
-require_once DOKU_INC.'inc/init.php';
-require_once DOKU_INC.'inc/HTTPClient.php';
-
class httpclient_http_test extends DokuWikiTest {
protected $server = 'http://httpbin.org';
+ /**
+ * @group internet
+ */
function test_simpleget(){
$http = new HTTPClient();
$data = $http->get($this->server.'/get?foo=bar');
@@ -16,6 +16,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertEquals(array('foo'=>'bar'), $resp['args']);
}
+ /**
+ * @group internet
+ */
function test_dget(){
$http = new HTTPClient();
$data = $http->dget($this->server.'/get',array('foo'=>'bar'));
@@ -26,6 +29,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertEquals(array('foo'=>'bar'), $resp['args']);
}
+ /**
+ * @group internet
+ */
function test_gzip(){
$http = new HTTPClient();
$data = $http->get($this->server.'/gzip');
@@ -36,6 +42,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertTrue($resp['gzipped']);
}
+ /**
+ * @group internet
+ */
function test_simplepost(){
$http = new HTTPClient();
$data = $http->post($this->server.'/post',array('foo'=>'bar'));
@@ -46,6 +55,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertEquals(array('foo'=>'bar'), $resp['form']);
}
+ /**
+ * @group internet
+ */
function test_redirect(){
$http = new HTTPClient();
$data = $http->get($this->server.'/redirect/3');
@@ -56,6 +68,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertRegExp('/\/get$/', $resp['url']);
}
+ /**
+ * @group internet
+ */
function test_relredirect(){
$http = new HTTPClient();
$data = $http->get($this->server.'/relative-redirect/3');
@@ -66,6 +81,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertRegExp('/\/get$/', $resp['url']);
}
+ /**
+ * @group internet
+ */
function test_redirectfail(){
$http = new HTTPClient();
$data = $http->get($this->server.'/redirect/5');
@@ -73,6 +91,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertEquals('Maximum number of redirects exceeded',$http->error);
}
+ /**
+ * @group internet
+ */
function test_cookies(){
$http = new HTTPClient();
$http->get($this->server.'/cookies/set/foo/bar');
@@ -85,6 +106,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertEquals(array('foo'=>'bar'), $resp['cookies']);
}
+ /**
+ * @group internet
+ */
function test_teapot(){
$http = new HTTPClient();
$data = $http->get($this->server.'/status/418');
@@ -92,6 +116,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertEquals(418,$http->status);
}
+ /**
+ * @group internet
+ */
function test_maxbody(){
$http = new HTTPClient();
$http->max_bodysize = 250;
@@ -99,6 +126,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertTrue($data === false, 'HTTP response');
}
+ /**
+ * @group internet
+ */
function test_basicauth(){
$http = new HTTPClient();
$http->user = 'user';
@@ -110,6 +140,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertEquals(array('authenticated'=>true,'user'=>'user'), $resp);
}
+ /**
+ * @group internet
+ */
function test_basicauthfail(){
$http = new HTTPClient();
$http->user = 'user';
@@ -119,6 +152,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertEquals(401,$http->status);
}
+ /**
+ * @group internet
+ */
function test_timeout(){
$http = new HTTPClient();
$http->timeout = 5;
@@ -127,6 +163,9 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertEquals(-100,$http->status);
}
+ /**
+ * @group internet
+ */
function test_headers(){
$http = new HTTPClient();
$data = $http->get($this->server.'/response-headers?baz=&foo=bar');