xref: /dokuwiki/_test/tests/inc/utf8_romanize.test.php (revision 8cbc5ee84fe788597ede5266255a74af6da47555)
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
21*8cbc5ee8SAndreas 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(){
34*8cbc5ee8SAndreas Gohr        $this->assertEquals("a A a A a o O",\dokuwiki\Utf8\Clean::romanize("å Å ä Ä ä ö Ö"));
35f7161c34SAndreas Gohr    }
36f7161c34SAndreas Gohr}
37f7161c34SAndreas Gohr//Setup VIM: ex: et ts=4 :
38