1<?php 2 3require_once DOKU_INC.'inc/mail.php'; 4 5class mail_quotedprintable_encode extends DokuWikiTest { 6 7 function test_simple(){ 8 $in = 'hello'; 9 $out = 'hello'; 10 $this->assertEquals(mail_quotedprintable_encode($in),$out); 11 } 12 13 function test_spaceend(){ 14 $in = "hello \nhello"; 15 $out = "hello=20\nhello"; 16 $this->assertEquals(mail_quotedprintable_encode($in),$out); 17 } 18 19 function test_german_utf8(){ 20 $in = 'hello überlänge'; 21 $out = 'hello =C3=BCberl=C3=A4nge'; 22 $this->assertEquals(mail_quotedprintable_encode($in),$out); 23 } 24 25 function test_wrap(){ 26 $in = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789'; 27 $out = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234=\n56789 123456789"; 28 $this->assertEquals(mail_quotedprintable_encode($in,74),$out); 29 } 30 31 function test_nowrap(){ 32 $in = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789'; 33 $out = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789'; 34 $this->assertEquals(mail_quotedprintable_encode($in,0),$out); 35 } 36 37 function test_russian_utf8(){ 38 $in = 'Ваш пароль для системы Доку Вики'; 39 $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'; 40 $this->assertEquals(mail_quotedprintable_encode($in,0),$out); 41 } 42} 43 44//Setup VIM: ex: et ts=4 : 45