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