Skip to content

Commit

Permalink
[11.x] improvement test for string title (#51015)
Browse files Browse the repository at this point in the history
* test(SupportStrTest.php): improvement test for string title

* test(SupportStrTest.php): add test for special characters

* fix: code style
  • Loading branch information
saMahmoudzadeh authored Apr 10, 2024
1 parent 4e3b785 commit 57c6823
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Support/SupportStrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ public function testStringTitle()
{
$this->assertSame('Jefferson Costella', Str::title('jefferson costella'));
$this->assertSame('Jefferson Costella', Str::title('jefFErson coSTella'));

$this->assertSame('', Str::title(''));
$this->assertSame('123 Laravel', Str::title('123 laravel'));
$this->assertSame('❤Laravel', Str::title('❤laravel'));
$this->assertSame('Laravel ❤', Str::title('laravel ❤'));
$this->assertSame('Laravel123', Str::title('laravel123'));
$this->assertSame('Laravel123', Str::title('Laravel123'));

$longString = 'lorem ipsum '.str_repeat('dolor sit amet ', 1000);
$expectedResult = 'Lorem Ipsum Dolor Sit Amet '.str_repeat('Dolor Sit Amet ', 999);
$this->assertSame($expectedResult, Str::title($longString));
}

public function testStringHeadline()
Expand Down

0 comments on commit 57c6823

Please sign in to comment.