xref: /dokuwiki/_test/tests/inc/utf8_stripspecials.test.php (revision 5a0eec47d375f076d810160503bdd303f8cf62a0)
1<?php
2// use no mbstring help here
3if(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1);
4require_once DOKU_INC.'inc/utf8.php';
5
6class utf8_stripspecials extends DokuWikiTest {
7
8
9    function test1(){
10        // we test multiple cases here - format: string, repl, additional, test
11        $tests   = array();
12        $tests[] = array('asciistring','','','asciistring');
13        $tests[] = array('asciistring','','\._\-:','asciistring');
14        $tests[] = array('ascii.string','','\._\-:','asciistring');
15        $tests[] = array('ascii.string',' ','\._\-:','ascii string');
16        $tests[] = array('2.1.14',' ','\._\-:','2 1 14');
17        $tests[] = array('ascii.string','','\._\-:\*','asciistring');
18        $tests[] = array('ascii.string',' ','\._\-:\*','ascii string');
19        $tests[] = array('2.1.14',' ','\._\-:\*','2 1 14');
20        $tests[] = array('string with nbsps','_','\*','string_with_nbsps');
21
22        foreach($tests as $test){
23            $this->assertEquals(utf8_stripspecials($test[0],$test[1],$test[2]),$test[3]);
24        }
25    }
26
27}
28//Setup VIM: ex: et ts=4 :
29