Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Add some tests in SupportStrTest class #51235

Merged
merged 4 commits into from
Apr 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improvement tests for Str::words
  • Loading branch information
saMahmoudzadeh committed Apr 28, 2024
commit fc655b66d3f8d83b1867394923079356788c242c
8 changes: 6 additions & 2 deletions tests/Support/SupportStrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@

class SupportStrTest extends TestCase
{
public function testStringCanBeLimitedByWords()
public function testStringCanBeLimitedByWords(): void
{
$this->assertSame('Taylor...', Str::words('Taylor Otwell', 1));
$this->assertSame('Taylor___', Str::words('Taylor Otwell', 1, '___'));
$this->assertSame('Taylor Otwell', Str::words('Taylor Otwell', 3));
$this->assertSame('Taylor Otwell', Str::words('Taylor Otwell', -1, '...'));
$this->assertSame('', Str::words('', 3, '...'));
}

public function testStringCanBeLimitedByWordsNonAscii()
Expand Down Expand Up @@ -114,11 +116,13 @@ public function testStringApa()
$this->assertSame(' ', Str::apa(' '));
}

public function testStringWithoutWordsDoesntProduceError()
public function testStringWithoutWordsDoesntProduceError(): void
{
$nbsp = chr(0xC2).chr(0xA0);
$this->assertSame(' ', Str::words(' '));
$this->assertEquals($nbsp, Str::words($nbsp));
$this->assertSame(' ', Str::words(' '));
$this->assertSame("\t\t\t", Str::words("\t\t\t"));
}

public function testStringAscii()
Expand Down