[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 // use no mbstring help here 3 if(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1); 4 5 class safeFN_test extends DokuWikiTest { 6 7 8 function test1(){ 9 // we test multiple cases here - format: string, repl, additional, test 10 $tests = array(); 11 $tests[] = array('äa.txt', '%5g]a.txt'); 12 $tests[] = array('ä.', '%5g].'); 13 $tests[] = array('asciistring','asciistring'); 14 $tests[] = array('ascii-_/.string','ascii-_/.string'); 15 $tests[] = array('AName','%x%1a]ame'); 16 $tests[] = array('A Name','%x%0%1a]ame'); 17 $tests[] = array('Another...Name','%x]nother...%1a]ame'); 18 $tests[] = array('Aß∂ƒName','%x%5b%6oy%aa%1a]ame'); 19 $tests[] = array('A%ß-∂_.ƒName','%x%%5b]-%6oy]_.%aa%1a]ame'); 20 $tests[] = array('A%%ß-∂_.ƒName','%x%%%5b]-%6oy]_.%aa%1a]ame'); 21 $tests[] = array('데이터도 함께 복원됩니다. 강력한','%zf4%13dg%15ao%zhg%0%164o%yig%0%11at%138w%zk9%zag%zb8].%0%xyt%10cl%164c]'); 22 $tests[] = array('совместимая','%td%ta%sy%t8%t1%td%te%t4%t8%sw%tr]'); 23 $tests[] = array('нехватка_файлового_пространства_на_сервере_p0-squid.some.domain.1270211897.txt.gz','%t9%t1%th%sy%sw%te%t6%sw]_%tg%sw%t5%t7%ta%sy%ta%sz%ta]_%tb%tc%ta%td%te%tc%sw%t9%td%te%sy%sw]_%t9%sw]_%td%t1%tc%sy%t1%tc%t1]_p0-squid.some.domain.1270211897.txt.gz'); 24 25 $tests[] = array('name[1]','name[1]'); 26 $tests[] = array('Name[1]','%1a]ame[1]'); 27 $tests[] = array('Name[A]','%1a]ame[%x]]'); 28 29 foreach($tests as $test){ 30 list($utf8,$safe) = $test; 31 $this->assertEquals(SafeFN::encode($utf8),$safe); 32 $this->assertEquals(SafeFN::decode($safe),$utf8); 33 } 34 } 35 36 function test2(){ 37 $tests[] = array('совместимая','%td%ta%sy%t8%t1%td%te%t4%t8%sw%tr'); 38 39 foreach($tests as $test){ 40 list($utf8,$safe) = $test; 41 $this->assertEquals(SafeFN::decode($safe),$utf8); 42 } 43 } 44 45 } 46 //Setup VIM: ex: et ts=4 :
title
Description
Body
title
Description
Body
title
Description
Body
title
Body