1<?php
2
3class common_obfuscate_test extends DokuWikiTest {
4
5    function test_none(){
6        global $conf;
7        $conf['mailguard'] = 'none';
8        $this->assertEquals('jon-doe@example.com', obfuscate('jon-doe@example.com'));
9    }
10
11    function test_hex(){
12        global $conf;
13        $conf['mailguard'] = 'hex';
14        $this->assertEquals('&#106;&#111;&#110;&#45;&#100;&#111;&#101;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;',
15                            obfuscate('jon-doe@example.com'));
16    }
17
18    function test_hex_utf32(){
19        global $conf;
20        $conf['mailguard'] = 'hex';
21        $this->assertEquals('&#117;&#115;&#101;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#63;&#115;&#117;&#98;&#106;&#101;&#99;&#116;&#61;&#x41f;&#x440;&#x438;&#x432;&#x435;&#x442;',
22                            obfuscate('user@example.com?subject=Привет'));
23    }
24
25    function test_visible(){
26        global $conf;
27        $conf['mailguard'] = 'visible';
28        $this->assertEquals('jon [dash] doe [at] example [dot] com', obfuscate('jon-doe@example.com'));
29    }
30
31
32}
33//Setup VIM: ex: et ts=4 :
34