xref: /dokuwiki/_test/tests/inc/utf8_romanize.test.php (revision 24486f8c927a3ff9461f40012c32397e0040d044)
1f7161c34SAndreas Gohr<?php
2f7161c34SAndreas Gohr// use no mbstring help here
3f7161c34SAndreas Gohrif(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1);
4f7161c34SAndreas Gohr
5f7161c34SAndreas Gohr/**
6f7161c34SAndreas Gohr * @group slow
7f7161c34SAndreas Gohr */
836340418SAndreas Gohrclass utf8_romanize_test extends DokuWikiTest {
9f7161c34SAndreas Gohr
10f7161c34SAndreas Gohr    /**
11f7161c34SAndreas Gohr     * Check Japanese romanization
12f7161c34SAndreas Gohr     *
13f7161c34SAndreas Gohr     * @author Denis Scheither <amorphis@uni-bremen.de>
14f7161c34SAndreas Gohr     */
15f7161c34SAndreas Gohr    function test_japanese(){
16f7161c34SAndreas Gohr        $tests = file(dirname(__FILE__).'/utf8_kanaromaji.txt');
17f7161c34SAndreas Gohr        $line = 1;
18f7161c34SAndreas Gohr        foreach($tests as $test){
19f7161c34SAndreas Gohr            list($jap,$rom) = explode(';',trim($test));
20f7161c34SAndreas Gohr
218cbc5ee8SAndreas Gohr            $chk = \dokuwiki\Utf8\Clean::romanize($jap);
22f7161c34SAndreas Gohr            $this->assertEquals($rom,$chk,"$jap\t->\t$chk\t!=\t$rom\t($line)");
23f7161c34SAndreas Gohr            $line++;
24f7161c34SAndreas Gohr        }
25f7161c34SAndreas Gohr    }
26f7161c34SAndreas Gohr
27f7161c34SAndreas Gohr    /**
28f7161c34SAndreas Gohr     * Test romanization of character that would usually be deaccented in a different
29f7161c34SAndreas Gohr     * way FS#1117
30f7161c34SAndreas Gohr     *
31f7161c34SAndreas Gohr     * @author Andreas Gohr <andi@splitbrain.org>
32f7161c34SAndreas Gohr     */
33f7161c34SAndreas Gohr    function test_deaccented(){
348cbc5ee8SAndreas Gohr        $this->assertEquals("a A a A a o O",\dokuwiki\Utf8\Clean::romanize("å Å ä Ä ä ö Ö"));
35f7161c34SAndreas Gohr    }
36*24486f8cSAndreas Gohr
37*24486f8cSAndreas Gohr    /**
38*24486f8cSAndreas Gohr     * Greeklish romanization
39*24486f8cSAndreas Gohr     */
40*24486f8cSAndreas Gohr    function test_greeklish(){
41*24486f8cSAndreas Gohr        $this->assertEquals('kalimera pos eiste',\dokuwiki\Utf8\Clean::romanize('Καλημέρα πώς είστε'));
42f7161c34SAndreas Gohr    }
43*24486f8cSAndreas Gohr
44*24486f8cSAndreas Gohr}
45*24486f8cSAndreas Gohr
46