diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2013-05-06 01:03:17 +0100 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2013-05-06 01:03:17 +0100 |
commit | a3d0aa224c509ed311955813d6eb459d1dc141c8 (patch) | |
tree | 211a8c03ac7007e7e45f63f05bb981ce5c4922cc | |
parent | b1720e5c647585ac14f86e6080b54c932cac9bee (diff) | |
download | rpg-a3d0aa224c509ed311955813d6eb459d1dc141c8.tar.gz rpg-a3d0aa224c509ed311955813d6eb459d1dc141c8.tar.bz2 |
add some tests for ml()
-rw-r--r-- | _test/tests/inc/common_ml.test.php | 77 |
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..ac4158540 --- /dev/null +++ b/_test/tests/inc/common_ml.test.php @@ -0,0 +1,77 @@ +<?php + +class common_wl_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&c=d&q=%26%C3%A4&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&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&c=d&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.'&tok='.$tok.'&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.'&tok='.$tok.'&media='.$id; + $this->assertEquals($expect, ml($id, $args)); + } +}
\ No newline at end of file |