[String] Transliterate & to and

This commit is contained in:
Bozhidar Hristov 2020-02-12 18:49:35 +02:00 committed by Fabien Potencier
parent 31fb219896
commit 76ff984ab5
2 changed files with 3 additions and 0 deletions

View File

@ -98,6 +98,7 @@ class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
return (new UnicodeString($string))
->ascii($transliterator)
->replace('@', $separator.'at'.$separator)
->replace('&', $separator.'and'.$separator)
->replaceMatches('/[^A-Za-z0-9]++/', $separator)
->trim($separator)
;

View File

@ -31,6 +31,8 @@ class SluggerTest extends TestCase
{
return [
['Стойността трябва да бъде лъжа', 'bg', 'Stoinostta-tryabva-da-bude-luzha'],
['You & I', 'en', 'You-and-I'],
['symfony@symfony.com', 'en', 'symfony-at-symfony-com'],
['Dieser Wert sollte größer oder gleich', 'de', 'Dieser-Wert-sollte-groesser-oder-gleich'],
['Dieser Wert sollte größer oder gleich', 'de_AT', 'Dieser-Wert-sollte-groesser-oder-gleich'],
['Αυτή η τιμή πρέπει να είναι ψευδής', 'el', 'Avti-i-timi-prepi-na-inai-psevdhis'],