xref: /dokuwiki/_test/tests/inc/utf8_basename.test.php (revision f393a4eb51a5f8ed0e64f09f76cbafe57d7dcb57)
1*f393a4ebSAndreas Gohr<?php
2*f393a4ebSAndreas Gohr
3*f393a4ebSAndreas Gohrclass utf8_basename_test extends DokuWikiTest {
4*f393a4ebSAndreas Gohr
5*f393a4ebSAndreas Gohr     function test1(){
6*f393a4ebSAndreas Gohr        $data = array(
7*f393a4ebSAndreas Gohr            array('/this/foo/bar.test.png',         '', 'bar.test.png'),
8*f393a4ebSAndreas Gohr            array('\\this\\foo\\bar.test.png',      '', 'bar.test.png'),
9*f393a4ebSAndreas Gohr            array('/this\\foo/bar.test.png',        '', 'bar.test.png'),
10*f393a4ebSAndreas Gohr            array('/this/foo\\bar.test.png',        '', 'bar.test.png'),
11*f393a4ebSAndreas Gohr
12*f393a4ebSAndreas Gohr            array('/this/ДокуВики/bar.test.png',    '', 'bar.test.png'),
13*f393a4ebSAndreas Gohr            array('\\this\\ДокуВики\\bar.test.png', '', 'bar.test.png'),
14*f393a4ebSAndreas Gohr            array('/this\\ДокуВики/bar.test.png',   '', 'bar.test.png'),
15*f393a4ebSAndreas Gohr            array('/this/ДокуВики\\bar.test.png',   '', 'bar.test.png'),
16*f393a4ebSAndreas Gohr
17*f393a4ebSAndreas Gohr            array('/this/foo/ДокуВики.test.png',    '', 'ДокуВики.test.png'),
18*f393a4ebSAndreas Gohr            array('\\this\\foo\\ДокуВики.test.png', '', 'ДокуВики.test.png'),
19*f393a4ebSAndreas Gohr            array('/this\\foo/ДокуВики.test.png',   '', 'ДокуВики.test.png'),
20*f393a4ebSAndreas Gohr            array('/this/foo\\ДокуВики.test.png',   '', 'ДокуВики.test.png'),
21*f393a4ebSAndreas Gohr
22*f393a4ebSAndreas Gohr            array('/this/foo/bar.test.png',         '.png', 'bar.test'),
23*f393a4ebSAndreas Gohr            array('\\this\\foo\\bar.test.png',      '.png', 'bar.test'),
24*f393a4ebSAndreas Gohr            array('/this\\foo/bar.test.png',        '.png', 'bar.test'),
25*f393a4ebSAndreas Gohr            array('/this/foo\\bar.test.png',        '.png', 'bar.test'),
26*f393a4ebSAndreas Gohr
27*f393a4ebSAndreas Gohr            array('/this/ДокуВики/bar.test.png',    '.png', 'bar.test'),
28*f393a4ebSAndreas Gohr            array('\\this\\ДокуВики\\bar.test.png', '.png', 'bar.test'),
29*f393a4ebSAndreas Gohr            array('/this\\ДокуВики/bar.test.png',   '.png', 'bar.test'),
30*f393a4ebSAndreas Gohr            array('/this/ДокуВики\\bar.test.png',   '.png', 'bar.test'),
31*f393a4ebSAndreas Gohr
32*f393a4ebSAndreas Gohr            array('/this/foo/ДокуВики.test.png',    '.png', 'ДокуВики.test'),
33*f393a4ebSAndreas Gohr            array('\\this\\foo\\ДокуВики.test.png', '.png', 'ДокуВики.test'),
34*f393a4ebSAndreas Gohr            array('/this\\foo/ДокуВики.test.png',   '.png', 'ДокуВики.test'),
35*f393a4ebSAndreas Gohr            array('/this/foo\\ДокуВики.test.png',   '.png', 'ДокуВики.test'),
36*f393a4ebSAndreas Gohr
37*f393a4ebSAndreas Gohr            array('/this/foo/bar.test.png',         '.foo', 'bar.test.png'),
38*f393a4ebSAndreas Gohr            array('\\this\\foo\\bar.test.png',      '.foo', 'bar.test.png'),
39*f393a4ebSAndreas Gohr            array('/this\\foo/bar.test.png',        '.foo', 'bar.test.png'),
40*f393a4ebSAndreas Gohr            array('/this/foo\\bar.test.png',        '.foo', 'bar.test.png'),
41*f393a4ebSAndreas Gohr
42*f393a4ebSAndreas Gohr            array('/this/ДокуВики/bar.test.png',    '.foo', 'bar.test.png'),
43*f393a4ebSAndreas Gohr            array('\\this\\ДокуВики\\bar.test.png', '.foo', 'bar.test.png'),
44*f393a4ebSAndreas Gohr            array('/this\\ДокуВики/bar.test.png',   '.foo', 'bar.test.png'),
45*f393a4ebSAndreas Gohr            array('/this/ДокуВики\\bar.test.png',   '.foo', 'bar.test.png'),
46*f393a4ebSAndreas Gohr
47*f393a4ebSAndreas Gohr            array('/this/foo/ДокуВики.test.png',    '.foo', 'ДокуВики.test.png'),
48*f393a4ebSAndreas Gohr            array('\\this\\foo\\ДокуВики.test.png', '.foo', 'ДокуВики.test.png'),
49*f393a4ebSAndreas Gohr            array('/this\\foo/ДокуВики.test.png',   '.foo', 'ДокуВики.test.png'),
50*f393a4ebSAndreas Gohr            array('/this/foo\\ДокуВики.test.png',   '.foo', 'ДокуВики.test.png'),
51*f393a4ebSAndreas Gohr
52*f393a4ebSAndreas Gohr
53*f393a4ebSAndreas Gohr            array('/this/foo/ДокуВики.test.Вик',    '.foo', 'ДокуВики.test.Вик'),
54*f393a4ebSAndreas Gohr            array('\\this\\foo\\ДокуВики.test.Вик', '.foo', 'ДокуВики.test.Вик'),
55*f393a4ebSAndreas Gohr            array('/this\\foo/ДокуВики.test.Вик',   '.foo', 'ДокуВики.test.Вик'),
56*f393a4ebSAndreas Gohr            array('/this/foo\\ДокуВики.test.Вик',   '.foo', 'ДокуВики.test.Вик'),
57*f393a4ebSAndreas Gohr
58*f393a4ebSAndreas Gohr            array('/this/foo/ДокуВики.test.Вик',    '.Вик', 'ДокуВики.test'),
59*f393a4ebSAndreas Gohr            array('\\this\\foo\\ДокуВики.test.Вик', '.Вик', 'ДокуВики.test'),
60*f393a4ebSAndreas Gohr            array('/this\\foo/ДокуВики.test.Вик',   '.Вик', 'ДокуВики.test'),
61*f393a4ebSAndreas Gohr            array('/this/foo\\ДокуВики.test.Вик',   '.Вик', 'ДокуВики.test'),
62*f393a4ebSAndreas Gohr        );
63*f393a4ebSAndreas Gohr
64*f393a4ebSAndreas Gohr        foreach($data as $test){
65*f393a4ebSAndreas Gohr            $this->assertEquals($test[2], utf8_basename($test[0], $test[1]), "input: ('".$test[0]."', '".$test[1]."')");
66*f393a4ebSAndreas Gohr        }
67*f393a4ebSAndreas Gohr     }
68*f393a4ebSAndreas Gohr
69*f393a4ebSAndreas Gohr}