summaryrefslogtreecommitdiff
path: root/_test/tests/inc/common_ml.test.php
diff options
context:
space:
mode:
authorAnika Henke <anika@selfthinker.org>2013-06-02 23:14:12 +0100
committerAnika Henke <anika@selfthinker.org>2013-06-02 23:14:12 +0100
commit20beef63b4694afdc3d6c434c3d27c982b6a986b (patch)
tree9800833361010fe16a2f25a2b2e75a1b569f39f8 /_test/tests/inc/common_ml.test.php
parentbc1e9ee1b1fffcb554afced8504270032c97341f (diff)
parent21c9604e66bcb42ab5267e9873738a6e22250103 (diff)
downloadrpg-20beef63b4694afdc3d6c434c3d27c982b6a986b.tar.gz
rpg-20beef63b4694afdc3d6c434c3d27c982b6a986b.tar.bz2
Merge remote-tracking branch 'origin/master' into loggedin-class
Diffstat (limited to '_test/tests/inc/common_ml.test.php')
-rw-r--r--_test/tests/inc/common_ml.test.php77
1 files changed, 77 insertions, 0 deletions
diff --git a/_test/tests/inc/common_ml.test.php b/_test/tests/inc/common_ml.test.php
new file mode 100644
index 000000000..0abfde37a
--- /dev/null
+++ b/_test/tests/inc/common_ml.test.php
@@ -0,0 +1,77 @@
+<?php
+
+class common_ml_test extends DokuWikiTest {
+
+ private $script = 'lib/exe/fetch.php';
+
+ function test_ml_empty() {
+ global $conf;
+ $conf['useslash'] = 0;
+ $conf['userewrite'] = 0;
+ $conf['start'] = 'start';
+
+ $this->assertEquals(DOKU_BASE . $this->script . '?media=' , ml());
+ }
+
+ function test_ml_args_array() {
+ global $conf;
+ $conf['useslash'] = 0;
+ $conf['userewrite'] = 0;
+
+ $args = array('a' => 'b', 'c' => 'd', 'q' => '&ä');
+
+ $expect = DOKU_BASE . $this->script . '?a=b&amp;c=d&amp;q=%26%C3%A4&amp;media=some:';
+ $this->assertEquals($expect, ml('some:', $args));
+ }
+
+ function test_ml_args_string() {
+ global $conf;
+ $conf['useslash'] = 0;
+ $conf['userewrite'] = 0;
+
+ $args = 'a=b&c=d';
+
+ $expect = DOKU_BASE . $this->script . '?a=b&c=d&amp;media=some:';
+ $this->assertEquals($expect, ml('some:', $args));
+ }
+
+ function test_ml_args_comma_string() {
+ global $conf;
+ $conf['useslash'] = 0;
+ $conf['userewrite'] = 0;
+
+ $args = 'a=b,c=d';
+
+ $expect = DOKU_BASE . $this->script . '?a=b&amp;c=d&amp;media=some:';
+ $this->assertEquals($expect, ml('some:', $args));
+ }
+
+
+ function test_ml_imgresize_array() {
+ global $conf;
+ $conf['useslash'] = 0;
+ $conf['userewrite'] = 0;
+
+ $id = 'some:';
+ $w = 80;
+ $args = array('w' => $w);
+ $tok = media_get_token($id,$w,0);
+
+ $expect = DOKU_BASE . $this->script . '?w='.$w.'&amp;tok='.$tok.'&amp;media='.$id;
+ $this->assertEquals($expect, ml($id, $args));
+ }
+
+ function test_ml_imgresize_string() {
+ global $conf;
+ $conf['useslash'] = 0;
+ $conf['userewrite'] = 0;
+
+ $id = 'some:';
+ $w = 80;
+ $args = 'w='.$w;
+ $tok = media_get_token($id,$w,0);
+
+ $expect = DOKU_BASE . $this->script . '?w='.$w.'&amp;tok='.$tok.'&amp;media='.$id;
+ $this->assertEquals($expect, ml($id, $args));
+ }
+}