@@ -79,22 +79,27 @@ public function test_kebab(): void
7979 $ this ->assertTrue (str ('foo-bar_baz ' )->kebab ()->equals ('foo-bar-baz ' ));
8080 }
8181
82- public function test_snake (): void
83- {
84- $ this ->assertTrue (str ('' )->snake ()->equals ('' ));
85- $ this ->assertTrue (str ('foo bar ' )->snake ()->equals ('foo_bar ' ));
86- $ this ->assertTrue (str ('foo - bar ' )->snake ()->equals ('foo_bar ' ));
87- $ this ->assertTrue (str ('foo__bar ' )->snake ()->equals ('foo_bar ' ));
88- $ this ->assertTrue (str ('_foo__bar ' )->snake ()->equals ('foo_bar ' ));
89- $ this ->assertTrue (str ('-foo__bar ' )->snake ()->equals ('foo_bar ' ));
90- $ this ->assertTrue (str ('fooBar ' )->snake ()->equals ('foo_bar ' ));
91- $ this ->assertTrue (str ('foo_bar ' )->snake ()->equals ('foo_bar ' ));
92- $ this ->assertTrue (str ('foo_bar1 ' )->snake ()->equals ('foo_bar1 ' ));
93- $ this ->assertTrue (str ('1foo_bar ' )->snake ()->equals ('1foo_bar ' ));
94- $ this ->assertTrue (str ('1foo_bar11 ' )->snake ()->equals ('1foo_bar11 ' ));
95- $ this ->assertTrue (str ('1foo_1bar1 ' )->snake ()->equals ('1foo_1bar1 ' ));
96- $ this ->assertTrue (str ('foo-barBaz ' )->snake ()->equals ('foo_bar_baz ' ));
97- $ this ->assertTrue (str ('foo-bar_baz ' )->snake ()->equals ('foo_bar_baz ' ));
82+ #[TestWith(['' , '' ])]
83+ #[TestWith(['foo bar ' , 'foo_bar ' ])]
84+ #[TestWith(['foo - bar ' , 'foo_bar ' ])]
85+ #[TestWith(['foo__bar ' , 'foo_bar ' ])]
86+ #[TestWith(['_foo__bar ' , 'foo_bar ' ])]
87+ #[TestWith(['-foo__bar ' , 'foo_bar ' ])]
88+ #[TestWith(['fooBar ' , 'foo_bar ' ])]
89+ #[TestWith(['foo_bar ' , 'foo_bar ' ])]
90+ #[TestWith(['foo_bar1 ' , 'foo_bar1 ' ])]
91+ #[TestWith(['1foo_bar ' , '1foo_bar ' ])]
92+ #[TestWith(['1foo_bar11 ' , '1foo_bar11 ' ])]
93+ #[TestWith(['1foo_1bar1 ' , '1foo_1bar1 ' ])]
94+ #[TestWith(['foo-barBaz ' , 'foo_bar_baz ' ])]
95+ #[TestWith(['foo-bar_baz ' , 'foo_bar_baz ' ])]
96+ #[TestWith(['Application URI ' , 'application_uri ' ])]
97+ #[TestWith(['URI ' , 'uri ' ])]
98+ #[TestWith(['XMLHTTPRequest ' , 'xmlhttp_request ' ])]
99+ #[TestWith(['HTTPRequest ' , 'http_request ' ])]
100+ public function test_snake (string $ input , string $ output ): void
101+ {
102+ $ this ->assertEquals ($ output , str ($ input )->snake ()->toString ());
98103 }
99104
100105 #[TestWith([0 ])]
0 commit comments