@@ -672,6 +672,42 @@ public function testRepeat()
672
672
$ this ->assertSame ('aaaaa ' , Str::repeat ('a ' , 5 ));
673
673
$ this ->assertSame ('' , Str::repeat ('' , 5 ));
674
674
}
675
+
676
+ /**
677
+ * @dataProvider specialCharacterProvider
678
+ */
679
+ public function testTransliterate (string $ value , string $ expected ): void
680
+ {
681
+ $ this ->assertSame ($ expected , Str::transliterate ($ value ));
682
+ }
683
+
684
+ public function specialCharacterProvider (): array
685
+ {
686
+ return [
687
+ ['ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ ' , 'abcdefghijklmnopqrstuvwxyz ' ],
688
+ ['⓪①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳ ' , '01234567891011121314151617181920 ' ],
689
+ ['⓵⓶⓷⓸⓹⓺⓻⓼⓽⓾ ' , '12345678910 ' ],
690
+ ['⓿⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴ ' , '011121314151617181920 ' ],
691
+ [
'ⓣⓔⓢⓣ@ⓛⓐⓡⓐⓥⓔⓛ.ⓒⓞⓜ ' ,
'[email protected] ' ],
692
+ ['🎂 ' , '? ' ],
693
+ ['abcdefghijklmnopqrstuvwxyz ' , 'abcdefghijklmnopqrstuvwxyz ' ],
694
+ ['0123456789 ' , '0123456789 ' ],
695
+ ];
696
+ }
697
+
698
+ public function testTransliterateOverrideUnknown (): void
699
+ {
700
+ $ this ->assertSame ('HHH ' , Str::transliterate ('🎂🚧🏆 ' , 'H ' ));
701
+ $ this ->assertSame ('Hello ' , Str::transliterate ('🎂 ' , 'Hello ' ));
702
+ }
703
+
704
+ /**
705
+ * @dataProvider specialCharacterProvider
706
+ */
707
+ public function testTransliterateStrict (string $ value , string $ expected ): void
708
+ {
709
+ $ this ->assertSame ($ expected , Str::transliterate ($ value , '? ' , true ));
710
+ }
675
711
}
676
712
677
713
class StringableObjectStub
0 commit comments