xref: /dokuwiki/_test/tests/inc/utf8_stripspecials.test.php (revision bd9dab32dbf9956a33ffe2b84def740c0db664a4)
1<?php
2
3class utf8_stripspecials extends DokuWikiTest
4{
5
6    /**
7     * @return array
8     * @see testGivens
9     */
10    function provideGivens()
11    {
12        return [
13            ['asciistring', '', '', 'asciistring'],
14            ['asciistring', '', '\._\-:', 'asciistring'],
15            ['ascii.string', '', '\._\-:', 'asciistring'],
16            ['ascii.string', ' ', '\._\-:', 'ascii string'],
17            ['2.1.14', ' ', '\._\-:', '2 1 14'],
18            ['ascii.string', '', '\._\-:\*', 'asciistring'],
19            ['ascii.string', ' ', '\._\-:\*', 'ascii string'],
20            ['2.1.14', ' ', '\._\-:\*', '2 1 14'],
21            ['string with nbsps', '_', '\*', 'string_with_nbsps'],
22            ['αβγδεϝϛζηθικλμνξοπϟϙρστυφχψωϡ', '_', '', 'αβγδεϝϛζηθικλμνξοπϟϙρστυφχψωϡ'], // #3188
23        ];
24    }
25
26    /**
27     * @param string $string
28     * @param string $replacement
29     * @param string $additional
30     * @param string $expected
31     * @dataProvider provideGivens
32     */
33    function testGivens($string, $replacement, $additional, $expected)
34    {
35        $this->assertEquals($expected, \dokuwiki\Utf8\Clean::stripspecials($string, $replacement, $additional));
36    }
37
38}
39