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