xref: /dokuwiki/_test/tests/inc/auth_nameencode.test.php (revision ba09710ad34bb383ae3526e84490a3d545f78866)
1<?php
2
3class auth_nameencode_test extends DokuWikiTest {
4
5    function tearDown() {
6        global $cache_authname;
7        $cache_authname = array();
8    }
9
10    function test_simple(){
11        $in  = 'hey$you';
12        $out = 'hey%24you';
13        $this->assertEquals(auth_nameencode($in),$out);
14    }
15
16    function test_quote(){
17        $in  = 'hey"you';
18        $out = 'hey%22you';
19        $this->assertEquals(auth_nameencode($in),$out);
20    }
21
22    function test_complex(){
23        $in  = 'hey $ you !$%! foo ';
24        $out = 'hey%20%24%20you%20%21%24%25%21%20foo%20';
25        $this->assertEquals(auth_nameencode($in),$out);
26    }
27
28    function test_complexutf8(){
29        $in  = 'häü $ yü !$%! foo ';
30        $out = 'häü%20%24%20yü%20%21%24%25%21%20foo%20';
31        $this->assertEquals(auth_nameencode($in),$out);
32    }
33
34    function test_groupskipon(){
35        $in  = '@hey$you';
36        $out = '@hey%24you';
37        $this->assertEquals(auth_nameencode($in,true),$out);
38    }
39
40    function test_groupskipoff(){
41        $in  = '@hey$you';
42        $out = '%40hey%24you';
43        $this->assertEquals(auth_nameencode($in),$out);
44    }
45}
46
47//Setup VIM: ex: et ts=4 :
48