1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-11 15:54:04 +02:00

Fix #116 with breaking change: add locale parameter to toAscii

This fixes a previous regression in handling of some umlaut
characters, and commits a breaking change by adding the param
before $removeUnsupported
This commit is contained in:
Daniel St. Jules
2017-03-02 23:58:05 -05:00
parent edbda419cb
commit b0976c72b7
4 changed files with 69 additions and 20 deletions

View File

@@ -653,10 +653,11 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
/**
* @dataProvider toAsciiProvider()
*/
public function testToAscii($expected, $str, $removeUnsupported = true)
public function testToAscii($expected, $str, $locale = 'en',
$removeUnsupported = true)
{
$stringy = S::create($str);
$result = $stringy->toAscii($removeUnsupported);
$result = $stringy->toAscii($locale, $removeUnsupported);
$this->assertStringy($result);
$this->assertEquals($expected, $result);
$this->assertEquals($str, $stringy);
@@ -681,7 +682,10 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
array(' ', ''), // medium mathematical space (U+205F)
array(' ', ' '), // ideographic space (U+3000)
array('', '𐍉'), // some uncommon, unsupported character (U+10349)
array('𐍉', '𐍉', false),
array('𐍉', '𐍉', 'en', false),
array('aouAOU', 'äöüÄÖÜ'),
array('aeoeueAEOEUE', 'äöüÄÖÜ', 'de'),
array('aeoeueAEOEUE', 'äöüÄÖÜ', 'de_DE')
);
}