diff options
author | Dominik Eckelmann <deckelmann@gmail.com> | 2012-05-14 21:56:38 +0200 |
---|---|---|
committer | Dominik Eckelmann <deckelmann@gmail.com> | 2012-05-14 21:57:43 +0200 |
commit | 16f15a8172591c8e5725677b192ec836030b424a (patch) | |
tree | 31e6f153feb669c515b963760b8d719bc89461ab /_test/tests | |
parent | 8414853140930bdf4f14cfee2f8a532d47c07129 (diff) | |
download | rpg-16f15a8172591c8e5725677b192ec836030b424a.tar.gz rpg-16f15a8172591c8e5725677b192ec836030b424a.tar.bz2 |
empty ID in wl() will be treated as $conf['start']
Diffstat (limited to '_test/tests')
-rw-r--r-- | _test/tests/inc/common_wl.test.php | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/_test/tests/inc/common_wl.test.php b/_test/tests/inc/common_wl.test.php new file mode 100644 index 000000000..2e34dcae3 --- /dev/null +++ b/_test/tests/inc/common_wl.test.php @@ -0,0 +1,148 @@ +<?php + +class common_wl_test extends DokuWikiTest { + + function test_wl_empty() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + $conf['start'] = 'start'; + + $this->assertEquals(DOKU_BASE . DOKU_SCRIPT . '?id=start' , wl()); + } + + function test_wl_empty_rewrite1() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 1; + $conf['start'] = 'start'; + + $this->assertEquals(DOKU_BASE . 'start' , wl()); + } + + function test_wl_empty_rewrite2() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 2; + $conf['start'] = 'start'; + + $this->assertEquals(DOKU_BASE . DOKU_SCRIPT . '/start' , wl()); + } + + function test_wl_id() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some'; + $this->assertEquals($expect, wl('some')); + } + + function test_wl_id_ns() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:some'; + $this->assertEquals($expect, wl('some:some')); + } + + function test_wl_id_ns_start() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:'; + $this->assertEquals($expect, wl('some:')); + } + + function test_wl_args_array() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $args = array('a' => 'b', 'c' => 'd', 'q' => '&ä'); + + $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:&a=b&c=d&q=%26%C3%A4'; + $this->assertEquals($expect, wl('some:', $args)); + } + + function test_wl_args_string() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $args = 'a=b&c=d'; + + $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:&a=b&c=d'; + $this->assertEquals($expect, wl('some:', $args)); + } + + function test_wl_args_comma_string() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $args = 'a=b,c=d'; + + $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:&a=b&c=d'; + $this->assertEquals($expect, wl('some:', $args)); + } + + function test_wl_abs() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $expect = DOKU_URL . DOKU_SCRIPT . '?id=some:'; + $this->assertEquals($expect, wl('some:', '', true)); + } + + function test_wl_sep() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:&a=b&c=d'; + $this->assertEquals($expect, wl('some:', 'a=b,c=d', false, '&')); + } + + function test_wl_useslash() { + global $conf; + $conf['useslash'] = 1; + $conf['userewrite'] = 0; + + $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:&a=b&c=d'; + $this->assertEquals($expect, wl('some:', 'a=b,c=d', false, '&')); + } + + function test_wl_useslash_rewrite1() { + global $conf; + $conf['useslash'] = 1; + $conf['userewrite'] = 1; + + $expect = DOKU_BASE . 'some/?a=b&c=d'; + $this->assertEquals($expect, wl('some:', 'a=b,c=d', false, '&')); + } + + function test_wl_useslash_rewrite1_sub_page() { + global $conf; + $conf['useslash'] = 1; + $conf['userewrite'] = 1; + + $expect = DOKU_BASE . 'some/one?a=b&c=d'; + $this->assertEquals($expect, wl('some:one', 'a=b,c=d', false, '&')); + } + + function test_wl_useslash_rewrite2() { + global $conf; + $conf['useslash'] = 1; + $conf['userewrite'] = 2; + + $expect = DOKU_BASE . DOKU_SCRIPT . '/some/one?a=b&c=d'; + $this->assertEquals($expect, wl('some:one', 'a=b,c=d', false, '&')); + } + + + +}
\ No newline at end of file |