summaryrefslogtreecommitdiff
path: root/_test/tests/inc/mail_quoted_printable_encode.test.php
blob: 52ddf622844d45ada0154f178c79317ef481f3c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

class mail_quotedprintable_encode extends DokuWikiTest {

    function test_simple(){
        $in  = 'hello';
        $out = 'hello';
        $this->assertEquals(mail_quotedprintable_encode($in),$out);
    }

    function test_spaceend(){
        $in  = "hello \nhello";
        $out = "hello=20\nhello";
        $this->assertEquals(mail_quotedprintable_encode($in),$out);
    }

    function test_german_utf8(){
        $in  = 'hello überlänge';
        $out = 'hello =C3=BCberl=C3=A4nge';
        $this->assertEquals(mail_quotedprintable_encode($in),$out);
    }

    function test_wrap(){
        $in  = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789';
        $out = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234=\n56789 123456789";
        $this->assertEquals(mail_quotedprintable_encode($in,74),$out);
    }

    function test_nowrap(){
        $in  = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789';
        $out = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789';
        $this->assertEquals(mail_quotedprintable_encode($in,0),$out);
    }

    function test_russian_utf8(){
        $in  = 'Ваш пароль для системы Доку Вики';
        $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';
        $this->assertEquals(mail_quotedprintable_encode($in,0),$out);
    }
}

//Setup VIM: ex: et ts=4 :