xref: /dokuwiki/_test/tests/inc/utf8_romanize.test.php (revision f7161c34cbd45d87124ad25cf06d3ff57e3bc23f)
1*f7161c34SAndreas Gohr<?php
2*f7161c34SAndreas Gohr// use no mbstring help here
3*f7161c34SAndreas Gohrif(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1);
4*f7161c34SAndreas Gohr
5*f7161c34SAndreas Gohr/**
6*f7161c34SAndreas Gohr * @group slow
7*f7161c34SAndreas Gohr */
8*f7161c34SAndreas Gohrclass utf8_romanize_test extends PHPUnit_Framework_TestCase {
9*f7161c34SAndreas Gohr
10*f7161c34SAndreas Gohr    /**
11*f7161c34SAndreas Gohr     * Check Japanese romanization
12*f7161c34SAndreas Gohr     *
13*f7161c34SAndreas Gohr     * @author Denis Scheither <amorphis@uni-bremen.de>
14*f7161c34SAndreas Gohr     */
15*f7161c34SAndreas Gohr    function test_japanese(){
16*f7161c34SAndreas Gohr        $tests = file(dirname(__FILE__).'/utf8_kanaromaji.txt');
17*f7161c34SAndreas Gohr        $line = 1;
18*f7161c34SAndreas Gohr        foreach($tests as $test){
19*f7161c34SAndreas Gohr            list($jap,$rom) = explode(';',trim($test));
20*f7161c34SAndreas Gohr
21*f7161c34SAndreas Gohr            $chk = utf8_romanize($jap);
22*f7161c34SAndreas Gohr            $this->assertEquals($rom,$chk,"$jap\t->\t$chk\t!=\t$rom\t($line)");
23*f7161c34SAndreas Gohr            $line++;
24*f7161c34SAndreas Gohr        }
25*f7161c34SAndreas Gohr    }
26*f7161c34SAndreas Gohr
27*f7161c34SAndreas Gohr    /**
28*f7161c34SAndreas Gohr     * Test romanization of character that would usually be deaccented in a different
29*f7161c34SAndreas Gohr     * way FS#1117
30*f7161c34SAndreas Gohr     *
31*f7161c34SAndreas Gohr     * @author Andreas Gohr <andi@splitbrain.org>
32*f7161c34SAndreas Gohr     */
33*f7161c34SAndreas Gohr    function test_deaccented(){
34*f7161c34SAndreas Gohr        $this->assertEquals("a A a A a o O",utf8_romanize("å Å ä Ä ä ö Ö"));
35*f7161c34SAndreas Gohr    }
36*f7161c34SAndreas Gohr}
37*f7161c34SAndreas Gohr//Setup VIM: ex: et ts=4 :
38