summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorGerrit Uitslag <klapinklapin@gmail.com>2014-03-10 23:57:01 +0100
committerGerrit Uitslag <klapinklapin@gmail.com>2014-03-10 23:57:01 +0100
commitf97db66038968542deefbf9817a3dd49b67b1904 (patch)
tree6995f5bfd7017999a743c327474afc7b9514d94f /_test
parent6384941886832589f7bb3c13bc18115499cf9369 (diff)
parent9f12fc1cc9e916c3172a0cf8953ed70fd18f2ec1 (diff)
downloadrpg-f97db66038968542deefbf9817a3dd49b67b1904.tar.gz
rpg-f97db66038968542deefbf9817a3dd49b67b1904.tar.bz2
Merge remote-tracking branch 'origin/master' into userlink
Conflicts: inc/parser/renderer.php inc/template.php
Diffstat (limited to '_test')
-rw-r--r--_test/core/DokuWikiTest.php3
-rw-r--r--_test/core/TestRequest.php9
-rw-r--r--_test/tests/inc/common_pageinfo.test.php8
-rw-r--r--_test/tests/inc/httpclient_http.test.php153
-rw-r--r--_test/tests/inc/httpclient_http_proxy.test.php5
-rw-r--r--_test/tests/inc/httpclient_https_proxy.test.php15
-rw-r--r--_test/tests/inc/httpclient_mock.php46
-rw-r--r--_test/tests/inc/mailer.test.php5
-rw-r--r--_test/tests/inc/parserutils_get_renderer.test.php83
-rw-r--r--_test/tests/inc/utf8_strtolower.test.php23
-rw-r--r--_test/tests/test/basic.test.php16
11 files changed, 321 insertions, 45 deletions
diff --git a/_test/core/DokuWikiTest.php b/_test/core/DokuWikiTest.php
index 91eb5293b..f4521256a 100644
--- a/_test/core/DokuWikiTest.php
+++ b/_test/core/DokuWikiTest.php
@@ -115,5 +115,8 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase {
// reload language
$local = $conf['lang'];
trigger_event('INIT_LANG_LOAD', $local, 'init_lang', true);
+
+ global $INPUT;
+ $INPUT = new Input();
}
}
diff --git a/_test/core/TestRequest.php b/_test/core/TestRequest.php
index 0a54910ed..060e37d28 100644
--- a/_test/core/TestRequest.php
+++ b/_test/core/TestRequest.php
@@ -44,13 +44,18 @@ class TestRequest {
* @return TestResponse the resulting output of the request
*/
public function execute($uri='/doku.php') {
+ global $INPUT;
+ global $ID;
+ global $INFO;
+
// save old environment
$server = $_SERVER;
$session = $_SESSION;
$get = $_GET;
$post = $_POST;
$request = $_REQUEST;
-
+ $input = $INPUT;
+
// prepare the right URI
$this->setUri($uri);
@@ -74,6 +79,7 @@ class TestRequest {
// now execute dokuwiki and grep the output
header_remove();
ob_start('ob_start_callback');
+ $INPUT = new Input();
include(DOKU_INC.$this->script);
ob_end_flush();
@@ -89,6 +95,7 @@ class TestRequest {
$_GET = $get;
$_POST = $post;
$_REQUEST = $request;
+ $INPUT = $input;
return $response;
}
diff --git a/_test/tests/inc/common_pageinfo.test.php b/_test/tests/inc/common_pageinfo.test.php
index 0a1ea0a8f..2b230d9ce 100644
--- a/_test/tests/inc/common_pageinfo.test.php
+++ b/_test/tests/inc/common_pageinfo.test.php
@@ -38,6 +38,7 @@ class common_pageinfo_test extends DokuWikiTest {
$info['writable'] = true;
$info['editable'] = true;
$info['lastmod'] = false;
+ $info['currentrev'] = false;
$info['meta'] = array();
$info['ip'] = null;
$info['user'] = null;
@@ -77,6 +78,7 @@ class common_pageinfo_test extends DokuWikiTest {
$info['filepath'] = $filename;
$info['exists'] = true;
$info['lastmod'] = $rev;
+ $info['currentrev'] = $rev;
$info['meta'] = p_get_metadata($ID);
$this->assertEquals($info, pageinfo());
@@ -101,6 +103,7 @@ class common_pageinfo_test extends DokuWikiTest {
$info['filepath'] = $filename;
$info['exists'] = true;
$info['lastmod'] = $rev;
+ $info['currentrev'] = $rev;
$info['meta'] = p_get_metadata($ID);
$info['rev'] = '';
@@ -131,6 +134,7 @@ class common_pageinfo_test extends DokuWikiTest {
$info['namespace'] = 'wiki';
$info['meta'] = p_get_metadata($ID);
$info['rev'] = $REV;
+ $info['currentrev'] = $rev;
$info['filepath'] = str_replace('pages','attic',substr($filename,0,-3).$REV.'.txt.gz');
$this->assertEquals($info, pageinfo());
@@ -153,6 +157,7 @@ class common_pageinfo_test extends DokuWikiTest {
$info['namespace'] = 'wiki';
$info['exists'] = true;
$info['lastmod'] = $rev;
+ $info['currentrev'] = $rev;
$info['meta'] = p_get_metadata($ID);
$info['filepath'] = $filename;
@@ -197,6 +202,7 @@ class common_pageinfo_test extends DokuWikiTest {
$info['filepath'] = $filename;
$info['exists'] = true;
$info['lastmod'] = $rev;
+ $info['currentrev'] = $rev;
$info['meta'] = p_get_metadata($ID); // need $INFO set correctly for addLogEntry()
global $INFO;
@@ -226,6 +232,7 @@ class common_pageinfo_test extends DokuWikiTest {
touch($filename,$now);
$info['lastmod'] = $now;
+ $info['currentrev'] = $now;
$info['meta']['last_change'] = false;
$info['ip'] = null;
$info['user'] = null;
@@ -251,6 +258,7 @@ class common_pageinfo_test extends DokuWikiTest {
$info['filepath'] = $filename;
$info['exists'] = true;
$info['lastmod'] = $rev;
+ $info['currentrev'] = $rev;
$info['meta'] = p_get_metadata($ID);
// setup a draft, make it more recent than the current page
diff --git a/_test/tests/inc/httpclient_http.test.php b/_test/tests/inc/httpclient_http.test.php
index 43dd4478f..3446e1184 100644
--- a/_test/tests/inc/httpclient_http.test.php
+++ b/_test/tests/inc/httpclient_http.test.php
@@ -1,15 +1,22 @@
<?php
+require_once (__DIR__ . '/httpclient_mock.php');
+
class httpclient_http_test extends DokuWikiTest {
protected $server = 'http://httpbin.org';
+
/**
* @group internet
*/
function test_simpleget(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->get($this->server.'/get?foo=bar');
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$resp = json_decode($data, true);
$this->assertTrue(is_array($resp), 'JSON response');
$this->assertArrayHasKey('args',$resp);
@@ -20,9 +27,13 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_dget(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->dget($this->server.'/get',array('foo'=>'bar'));
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$resp = json_decode($data, true);
$this->assertTrue(is_array($resp), 'JSON response');
$this->assertArrayHasKey('args',$resp);
@@ -33,9 +44,13 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_gzip(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->get($this->server.'/gzip');
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$resp = json_decode($data, true);
$this->assertTrue(is_array($resp), 'JSON response');
$this->assertArrayHasKey('gzipped',$resp);
@@ -46,9 +61,13 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_simplepost(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->post($this->server.'/post',array('foo'=>'bar'));
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$resp = json_decode($data, true);
$this->assertTrue(is_array($resp), 'JSON response');
$this->assertArrayHasKey('form',$resp);
@@ -59,9 +78,13 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_redirect(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->get($this->server.'/redirect/3');
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$resp = json_decode($data, true);
$this->assertTrue(is_array($resp), 'JSON response');
$this->assertArrayHasKey('url',$resp);
@@ -72,9 +95,13 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_relredirect(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->get($this->server.'/relative-redirect/3');
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$resp = json_decode($data, true);
$this->assertTrue(is_array($resp), 'JSON response');
$this->assertArrayHasKey('url',$resp);
@@ -85,9 +112,13 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_redirectfail(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->get($this->server.'/redirect/5');
- $this->assertTrue($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertTrue($data === false, 'HTTP response '.$http->error);
$this->assertEquals('Maximum number of redirects exceeded',$http->error);
}
@@ -95,11 +126,19 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_cookies(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$http->get($this->server.'/cookies/set/foo/bar');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
$this->assertEquals(array('foo' => 'bar'), $http->cookies);
$data = $http->get($this->server.'/cookies');
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$resp = json_decode($data, true);
$this->assertTrue(is_array($resp), 'JSON response');
$this->assertArrayHasKey('cookies',$resp);
@@ -110,9 +149,13 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_teapot(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->get($this->server.'/status/418');
- $this->assertTrue($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertTrue($data === false, 'HTTP response '.$http->error);
$this->assertEquals(418,$http->status);
}
@@ -120,18 +163,26 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_maxbody(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$http->max_bodysize = 250;
// this should abort completely
$data = $http->get($this->server.'/stream/30');
- $this->assertTrue($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertTrue($data === false, 'HTTP response '.$http->error);
// this should read just the needed bytes
$http->max_bodysize_abort = false;
$http->keep_alive = false;
$data = $http->get($this->server.'/stream/30');
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
/* should read no more than max_bodysize+1 */
$this->assertLessThanOrEqual(251,strlen($data));
}
@@ -140,24 +191,36 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_maxbodyok(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$http->max_bodysize = 500*1024;
$data = $http->get($this->server.'/stream/5');
- $this->assertTrue($data !== false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertTrue($data !== false, 'HTTP response '.$http->error);
$http->max_bodysize_abort = false;
$data = $http->get($this->server.'/stream/5');
- $this->assertTrue($data !== false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertTrue($data !== false, 'HTTP response '.$http->error);
}
/**
* @group internet
*/
function test_basicauth(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$http->user = 'user';
$http->pass = 'pass';
$data = $http->get($this->server.'/basic-auth/user/pass');
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$resp = json_decode($data, true);
$this->assertTrue(is_array($resp), 'JSON response');
$this->assertEquals(array('authenticated'=>true,'user'=>'user'), $resp);
@@ -167,11 +230,15 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_basicauthfail(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$http->user = 'user';
$http->pass = 'invalid';
$data = $http->get($this->server.'/basic-auth/user/pass');
- $this->assertTrue($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertTrue($data === false, 'HTTP response '.$http->error);
$this->assertEquals(401,$http->status);
}
@@ -179,10 +246,10 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_timeout(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$http->timeout = 5;
$data = $http->get($this->server.'/delay/10');
- $this->assertTrue($data === false, 'HTTP response');
+ $this->assertTrue($data === false, 'HTTP response '.$http->error);
$this->assertEquals(-100,$http->status);
}
@@ -190,9 +257,13 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_headers(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->get($this->server.'/response-headers?baz=&foo=bar');
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$resp = json_decode($data, true);
$this->assertTrue(is_array($resp), 'JSON response');
$this->assertArrayHasKey('baz',$http->resp_headers);
@@ -204,9 +275,13 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_chunked(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->get('http://whoopdedo.org/cgi-bin/chunked/2550');
- $this->assertFalse($data === false, 'HTTP response');
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertFalse($data === false, 'HTTP response '.$http->error);
$this->assertEquals(2550,strlen($data));
}
@@ -216,13 +291,17 @@ class httpclient_http_test extends DokuWikiTest {
* @group internet
*/
function test_wikimatrix(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
$data = $http->get('http://www.wikimatrix.org/cfeed/dokuwiki/-/-');
- $this->assertTrue($data !== false, $http->error);
+ if($http->noconnection()) {
+ $this->markTestSkipped('connection timed out');
+ return;
+ }
+ $this->assertTrue($data !== false, 'HTTP response '.$http->error);
}
function test_postencode(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
// check simple data
diff --git a/_test/tests/inc/httpclient_http_proxy.test.php b/_test/tests/inc/httpclient_http_proxy.test.php
index 4aa039fcc..c44dc7ed7 100644
--- a/_test/tests/inc/httpclient_http_proxy.test.php
+++ b/_test/tests/inc/httpclient_http_proxy.test.php
@@ -1,5 +1,7 @@
<?php
+require_once (__DIR__ . '/httpclient_mock.php');
+
class httpclient_http_proxy_test extends DokuWikiTest {
protected $url = 'http://test.dokuwiki.org/README';
@@ -7,7 +9,7 @@ class httpclient_http_proxy_test extends DokuWikiTest {
* @group internet
*/
function test_simpleget(){
- $http = new HTTPClient();
+ $http = new HTTPMockClient();
// proxy provided by Andrwe Lord Weber <dokuwiki@andrwe.org>
$http->proxy_host = 'proxy.andrwe.org';
$http->proxy_port = 8080;
@@ -16,5 +18,4 @@ class httpclient_http_proxy_test extends DokuWikiTest {
$this->assertFalse($data === false, 'HTTP response '.$http->error);
$this->assertTrue(strpos($data,'DokuWiki') !== false, 'response content');
}
-
} \ No newline at end of file
diff --git a/_test/tests/inc/httpclient_https_proxy.test.php b/_test/tests/inc/httpclient_https_proxy.test.php
index aca3b3be2..9402e91af 100644
--- a/_test/tests/inc/httpclient_https_proxy.test.php
+++ b/_test/tests/inc/httpclient_https_proxy.test.php
@@ -12,4 +12,19 @@ class httpclient_https_proxy_test extends httpclient_http_proxy_test {
}
parent::setUp();
}
+
+ /**
+ * @group internet
+ */
+ function test_connectfail(){
+ $http = new HTTPMockClient();
+ // proxy provided by Andrwe Lord Weber <dokuwiki@andrwe.org>
+ $http->proxy_host = 'proxy.andrwe.org';
+ $http->proxy_port = 8080;
+
+ // the proxy accepts connections to dokuwiki.org only - the connect call should fail
+ $data = $http->get('https://www.google.com');
+ $this->assertFalse($data);
+ $this->assertEquals(-150, $http->status);
+ }
} \ No newline at end of file
diff --git a/_test/tests/inc/httpclient_mock.php b/_test/tests/inc/httpclient_mock.php
new file mode 100644
index 000000000..038045c8b
--- /dev/null
+++ b/_test/tests/inc/httpclient_mock.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Class HTTPMockClient
+ *
+ * Does not really mock the client, it still does real connections but will retry failed connections
+ * to work around shaky connectivity.
+ */
+class HTTPMockClient extends HTTPClient {
+ protected $tries;
+
+ /**
+ * Sets shorter timeout
+ */
+ function __construct() {
+ parent::__construct();
+ $this->timeout = 8; // slightly faster timeouts
+ }
+
+ /**
+ * Returns true if the connection timed out
+ *
+ * @return bool
+ */
+ function noconnection() {
+ return ($this->tries === 0);
+ }
+
+ /**
+ * Retries sending the request multiple times
+ *
+ * @param string $url
+ * @param string $data
+ * @param string $method
+ * @return bool
+ */
+ function sendRequest($url, $data = '', $method = 'GET') {
+ $this->tries = 2; // configures the number of retries
+ $return = false;
+ while($this->tries) {
+ $return = parent::sendRequest($url, $data, $method);
+ if($this->status != -100) break;
+ $this->tries--;
+ }
+ return $return;
+ }
+} \ No newline at end of file
diff --git a/_test/tests/inc/mailer.test.php b/_test/tests/inc/mailer.test.php
index 4541d9906..50d282864 100644
--- a/_test/tests/inc/mailer.test.php
+++ b/_test/tests/inc/mailer.test.php
@@ -191,7 +191,10 @@ class mailer_test extends DokuWikiTest {
// ask message lint if it is okay
$html = new HTTPClient();
$results = $html->post('http://tools.ietf.org/tools/msglint/msglint', array('msg'=>$msg));
- $this->assertTrue($results !== false);
+ if($results === false) {
+ $this->markTestSkipped('no response from validator');
+ return;
+ }
// parse the result lines
$lines = explode("\n", $results);
diff --git a/_test/tests/inc/parserutils_get_renderer.test.php b/_test/tests/inc/parserutils_get_renderer.test.php
new file mode 100644
index 000000000..69aeb3b19
--- /dev/null
+++ b/_test/tests/inc/parserutils_get_renderer.test.php
@@ -0,0 +1,83 @@
+<?php
+
+class parserutils_get_renderer_test extends DokuWikiTest {
+
+ private $plugin_controller;
+
+ // test default behaviour / usual settings
+ function test_p_get_renderer_normal() {
+ global $conf;
+
+ $old_conf = $conf;
+ $conf['renderer_xhtml'] = 'xhtml';
+
+ $this->assertInstanceOf('Doku_Renderer_xhtml', p_get_renderer('xhtml'));
+
+ $conf = $old_conf;
+ }
+
+ // test get a renderer plugin
+ function test_p_get_renderer_plugin() {
+ global $conf;
+ global $plugin_controller;
+
+ $old_conf = $conf;
+ $conf['renderer_xhtml'] = 'get_renderer_test';
+ $this->plugin_controller = $plugin_controller;
+ $plugin_controller = $this;
+
+ $this->assertInstanceOf('renderer_plugin_test', p_get_renderer('xhtml'));
+
+ $conf = $old_conf;
+ $plugin_controller = $this->plugin_controller;
+ }
+
+ // test fallback succeeds
+ function test_p_get_renderer_fallback() {
+ global $conf;
+
+ $old_conf = $conf;
+ $conf['renderer_xhtml'] = 'badvalue';
+
+ $this->assertInstanceOf('Doku_Renderer_xhtml', p_get_renderer('xhtml'));
+
+ $conf = $old_conf;
+ }
+
+ // test fallback fails
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ * @expectedExceptionCode E_USER_WARNING
+ */
+ function test_p_get_renderer_fallback_fail() {
+ global $conf;
+
+ $old_conf = $conf;
+ $conf['renderer_junk'] = 'badvalue';
+
+ $this->assertNull(p_get_renderer('junk'));
+
+ $conf = $old_conf;
+ }
+
+ // wrapper function for the fake plugin controller, return $this for the fake syntax of this test
+ function load($type,$name,$new=false,$disabled=false){
+ if ($name == 'get_renderer_test') {
+ return new renderer_plugin_test();
+ } else {
+ return $this->plugin_controller->load($type, $name, $new, $disabled);
+ }
+ }
+ }
+
+require_once DOKU_INC . 'inc/parser/xhtml.php';
+
+class renderer_plugin_test extends Doku_Renderer_xhtml {
+
+ function canRender($format) {
+ return ($format=='xhtml');
+ }
+
+}
+
+// vim:ts=4:sw=4:et:
diff --git a/_test/tests/inc/utf8_strtolower.test.php b/_test/tests/inc/utf8_strtolower.test.php
new file mode 100644
index 000000000..85f5b270b
--- /dev/null
+++ b/_test/tests/inc/utf8_strtolower.test.php
@@ -0,0 +1,23 @@
+<?php
+// use no mbstring help here
+if(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1);
+
+class utf8_strtolower_test extends DokuWikiTest {
+
+ function test_givens(){
+ $data = array(
+ 'Αρχιτεκτονική Μελέτη' => 'αρχιτεκτονική μελέτη', // FS#2173
+ );
+
+ foreach($data as $input => $expected) {
+ $this->assertEquals($expected, utf8_strtolower($input));
+ }
+
+ // just make sure our data was correct
+ if(function_exists('mb_strtolower')) {
+ foreach($data as $input => $expected) {
+ $this->assertEquals($expected, mb_strtolower($input, 'utf-8'));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/_test/tests/test/basic.test.php b/_test/tests/test/basic.test.php
index 86acef935..0639f0c5a 100644
--- a/_test/tests/test/basic.test.php
+++ b/_test/tests/test/basic.test.php
@@ -33,7 +33,7 @@ class InttestsBasicTest extends DokuWikiTest {
$response = $request->execute();
$this->assertTrue(
- strpos($response->getContent(), 'DokuWiki') >= 0,
+ strpos($response->getContent(), 'DokuWiki') !== false,
'DokuWiki was not a word in the output'
);
}
@@ -60,7 +60,7 @@ class InttestsBasicTest extends DokuWikiTest {
$this->assertEquals('wiki:dokuwiki', $request->getPost('id'));
// output check
- $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') >= 0);
+ $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') !== false);
}
function testPostGet() {
@@ -84,7 +84,7 @@ class InttestsBasicTest extends DokuWikiTest {
$this->assertEquals('wiki:dokuwiki', $request->getGet('id'));
// output check
- $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') >= 0);
+ $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') !== false);
}
function testGet() {
@@ -116,7 +116,7 @@ class InttestsBasicTest extends DokuWikiTest {
$this->assertEquals('bar', $request->getGet('test'));
// output check
- $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') >= 0);
+ $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') !== false);
}
function testScripts() {
@@ -168,5 +168,13 @@ class InttestsBasicTest extends DokuWikiTest {
$response = new TestResponse('',array_slice($this->some_headers,0,-2)); // slice off the last two headers to leave no status header
$this->assertNull($response->getStatusCode());
}
+
+ function testINPUT() {
+ $request = new TestRequest();
+ $response = $request->get(array('id' => 'mailinglist'), '/doku.php');
+
+ // output check
+ $this->assertTrue(strpos($response->getContent(), 'Netiquette') !== false);
+ }
}