[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 // use no mbstring help here 4 if(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1); 5 6 class utf8_html_test extends DokuWikiTest { 7 8 function test_from_1byte(){ 9 $in = 'a'; 10 $out = 'a'; 11 $this->assertEquals(\dokuwiki\Utf8\Conversion::toHtml($in),$out); 12 } 13 14 function test_from_1byte_all(){ 15 $in = 'a'; 16 $out = 'a'; 17 $this->assertEquals(\dokuwiki\Utf8\Conversion::toHtml($in, true),$out); 18 } 19 20 function test_from_2byte(){ 21 $in = "\xc3\xbc"; 22 $out = 'ü'; 23 $this->assertEquals(\dokuwiki\Utf8\Conversion::toHtml($in),$out); 24 } 25 26 function test_from_3byte(){ 27 $in = "\xe2\x99\x8a"; 28 $out = '♊'; 29 $this->assertEquals(\dokuwiki\Utf8\Conversion::toHtml($in),$out); 30 } 31 32 function test_from_4byte(){ 33 $in = "\xf4\x80\x80\x81"; 34 $out = '􀀁'; 35 $this->assertEquals(\dokuwiki\Utf8\Conversion::toHtml($in),$out); 36 } 37 38 function test_to_1byte(){ 39 $out = 'a'; 40 $in = 'a'; 41 $this->assertEquals(\dokuwiki\Utf8\Conversion::fromHtml($in),$out); 42 } 43 44 function test_to_2byte(){ 45 $out = "\xc3\xbc"; 46 $in = 'ü'; 47 $this->assertEquals(\dokuwiki\Utf8\Conversion::fromHtml($in),$out); 48 } 49 50 function test_to_3byte(){ 51 $out = "\xe2\x99\x8a"; 52 $in = '♊'; 53 $this->assertEquals(\dokuwiki\Utf8\Conversion::fromHtml($in),$out); 54 } 55 56 function test_to_4byte(){ 57 $out = "\xf4\x80\x80\x81"; 58 $in = '􀀁'; 59 $this->assertEquals(\dokuwiki\Utf8\Conversion::fromHtml($in),$out); 60 } 61 62 function test_without_entities(){ 63 $out = '&#38;&#38;'; 64 $in = '&#38;&amp;#38;'; 65 $this->assertEquals(\dokuwiki\Utf8\Conversion::fromHtml($in),$out); 66 } 67 68 function test_with_entities(){ 69 $out = '&&#38;'; 70 $in = '&#38;&amp;#38;'; 71 $this->assertEquals(\dokuwiki\Utf8\Conversion::fromHtml($in,HTML_ENTITIES),$out); 72 } 73 74 } 75 76 //Setup VIM: ex: et ts=4 :
title
Description
Body
title
Description
Body
title
Description
Body
title
Body