Skip to content

Commit 57c6823

Browse files
[11.x] improvement test for string title (#51015)
* test(SupportStrTest.php): improvement test for string title * test(SupportStrTest.php): add test for special characters * fix: code style
1 parent 4e3b785 commit 57c6823

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/Support/SupportStrTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ public function testStringTitle()
3737
{
3838
$this->assertSame('Jefferson Costella', Str::title('jefferson costella'));
3939
$this->assertSame('Jefferson Costella', Str::title('jefFErson coSTella'));
40+
41+
$this->assertSame('', Str::title(''));
42+
$this->assertSame('123 Laravel', Str::title('123 laravel'));
43+
$this->assertSame('❤Laravel', Str::title('❤laravel'));
44+
$this->assertSame('Laravel ❤', Str::title('laravel ❤'));
45+
$this->assertSame('Laravel123', Str::title('laravel123'));
46+
$this->assertSame('Laravel123', Str::title('Laravel123'));
47+
48+
$longString = 'lorem ipsum '.str_repeat('dolor sit amet ', 1000);
49+
$expectedResult = 'Lorem Ipsum Dolor Sit Amet '.str_repeat('Dolor Sit Amet ', 999);
50+
$this->assertSame($expectedResult, Str::title($longString));
4051
}
4152

4253
public function testStringHeadline()

0 commit comments

Comments
 (0)