summaryrefslogtreecommitdiff
path: root/_test
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
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')
-rw-r--r--_test/README6
-rw-r--r--_test/tests/inc/httpclient_http.test.php45
-rw-r--r--_test/tests/inc/utf8_romanize.test.php (renamed from _test/tests/inc/utf8_romanize.cputest.php)7
3 files changed, 51 insertions, 7 deletions
diff --git a/_test/README b/_test/README
index 8ef5b162b..358da0329 100644
--- a/_test/README
+++ b/_test/README
@@ -39,7 +39,11 @@ You can run a single test file by providing it as an argument to phpunit:
phpunit --stderr tests/inc/common_cleanText.test.php
-FIXME add info about test groups.
+You can also use groups to exclude certain test from running. For example use
+the following command to avoid long running test or tests accessing the
+Internet.
+
+ phpunit --stderr --exclude-group slow,internet
===== Create new Tests =====
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');
diff --git a/_test/tests/inc/utf8_romanize.cputest.php b/_test/tests/inc/utf8_romanize.test.php
index 66e3b76c9..d08346faa 100644
--- a/_test/tests/inc/utf8_romanize.cputest.php
+++ b/_test/tests/inc/utf8_romanize.test.php
@@ -1,8 +1,10 @@
<?php
// use no mbstring help here
if(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1);
-require_once DOKU_INC.'inc/utf8.php';
+/**
+ * @group slow
+ */
class utf8_romanize_test extends PHPUnit_Framework_TestCase {
/**
@@ -17,8 +19,7 @@ class utf8_romanize_test extends PHPUnit_Framework_TestCase {
list($jap,$rom) = explode(';',trim($test));
$chk = utf8_romanize($jap);
- #if($chk != $rom) echo "$jap\t->\t$chk\t!=\t$rom\t($line)\n";
- $this->assertEquals($chk,$rom);
+ $this->assertEquals($rom,$chk,"$jap\t->\t$chk\t!=\t$rom\t($line)");
$line++;
}
}