@@ -663,4 +663,41 @@ public function test_basename(): void
663663 $ this ->assertSame ('file ' , str ('file.txt ' )->basename ('.txt ' )->toString ());
664664 $ this ->assertSame ('' , str ()->basename ()->toString ());
665665 }
666+
667+ public function test_ascii (): void
668+ {
669+ $ this ->assertSame ('@ ' , str ('@ ' )->ascii ()->toString ());
670+ $ this ->assertSame ('u ' , str ('ü ' )->ascii ()->toString ());
671+ $ this ->assertSame ('' , str ('' )->ascii ()->toString ());
672+ $ this ->assertSame ('a!2e ' , str ('a!2ë ' )->ascii ()->toString ());
673+ }
674+
675+ public function test_slug (): void
676+ {
677+ $ this ->assertSame ('hello-world ' , str ('hello world ' )->slug ()->toString ());
678+ $ this ->assertSame ('hello-world ' , str ('hello-world ' )->slug ()->toString ());
679+ $ this ->assertSame ('hello-world ' , str ('hello_world ' )->slug ()->toString ());
680+ $ this ->assertSame ('hello_world ' , str ('hello_world ' )->slug (separator: '_ ' )->toString ());
681+ $ this ->assertSame ('user-at-host ' , str ('user@host ' )->slug ()->toString ());
682+ $ this ->assertSame ('slam-dnya ' , str ('سلام دنیا ' )->slug (separator: '- ' )->toString ());
683+ $ this ->assertSame ('sometext ' , str ('some text ' )->slug (separator: '' )->toString ());
684+ $ this ->assertSame ('' , str ()->slug (separator: '' )->toString ());
685+ $ this ->assertSame ('bsm-allh ' , str ('بسم الله ' )->slug (separator: '- ' , replacements: ['allh ' => 'allah ' ])->toString ());
686+ $ this ->assertSame ('500-dollar-bill ' , str ('500$ bill ' )->slug ('- ' , replaceSymbols: true )->toString ());
687+ $ this ->assertSame ('500-bill ' , str ('500$ bill ' )->slug ('- ' , replaceSymbols: false )->toString ());
688+ $ this ->assertSame ('500-dollar-bill ' , str ('500--$----bill ' )->slug (separator: '- ' )->toString ());
689+ $ this ->assertSame ('500-dollar-bill ' , str ('500-$-bill ' )->slug (separator: '- ' )->toString ());
690+ $ this ->assertSame ('500-dollar-bill ' , str ('500$--bill ' )->slug (separator: '- ' )->toString ());
691+ $ this ->assertSame ('500-dollar-bill ' , str ('500-$--bill ' )->slug (separator: '- ' )->toString ());
692+ $ this ->assertSame ('ahmdfyalmdrs ' , str ('أحمد@المدرسة ' )->slug (separator: '- ' , replacements: ['@ ' => 'في ' ])->toString ());
693+ }
694+
695+ public function test_is_ascii (): void
696+ {
697+ $ this ->assertTrue (str ('hello ' )->isAscii ());
698+ $ this ->assertTrue (str ()->isAscii ());
699+
700+ $ this ->assertFalse (str ('helloü ' )->isAscii ());
701+ $ this ->assertFalse (str ('بسم الله ' )->isAscii ());
702+ }
666703}
0 commit comments