xref: /dokuwiki/_test/tests/inc/mail_quoted_printable_encode.test.php (revision 32f6505fe52f99f50966e08334b7a07d2fbedc07)
1<?php
2
3class mail_quotedprintable_encode extends DokuWikiTest {
4
5    function test_simple(){
6        $in  = 'hello';
7        $out = 'hello';
8        $this->assertEquals(mail_quotedprintable_encode($in),$out);
9    }
10
11    function test_spaceend(){
12        $in  = "hello \nhello";
13        $out = "hello=20\nhello";
14        $this->assertEquals(mail_quotedprintable_encode($in),$out);
15    }
16
17    function test_german_utf8(){
18        $in  = 'hello überlänge';
19        $out = 'hello =C3=BCberl=C3=A4nge';
20        $this->assertEquals(mail_quotedprintable_encode($in),$out);
21    }
22
23    function test_wrap(){
24        $in  = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789';
25        $out = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234=\n56789 123456789";
26        $this->assertEquals(mail_quotedprintable_encode($in,74),$out);
27    }
28
29    function test_nowrap(){
30        $in  = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789';
31        $out = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789';
32        $this->assertEquals(mail_quotedprintable_encode($in,0),$out);
33    }
34
35    function test_russian_utf8(){
36        $in  = 'Ваш пароль для системы Доку Вики';
37        $out = '=D0=92=D0=B0=D1=88 =D0=BF=D0=B0=D1=80=D0=BE=D0=BB=D1=8C =D0=B4=D0=BB=D1=8F =D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D1=8B =D0=94=D0=BE=D0=BA=D1=83 =D0=92=D0=B8=D0=BA=D0=B8';
38        $this->assertEquals(mail_quotedprintable_encode($in,0),$out);
39    }
40}
41
42//Setup VIM: ex: et ts=4 :
43