forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11.x] Add some tests to
SupportStrTest
(laravel#51437)
* Add some tests * fixes
- Loading branch information
1 parent
46d2c39
commit 6727464
Showing
1 changed file
with
14 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,10 +125,12 @@ public function testStringWithoutWordsDoesntProduceError(): void | |
$this->assertSame("\t\t\t", Str::words("\t\t\t")); | ||
} | ||
|
||
public function testStringAscii() | ||
public function testStringAscii(): void | ||
{ | ||
$this->assertSame('@', Str::ascii('@')); | ||
$this->assertSame('u', Str::ascii('ü')); | ||
$this->assertSame('', Str::ascii('')); | ||
$this->assertSame('a!2e', Str::ascii('a!2ë')); | ||
} | ||
|
||
public function testStringAsciiWithSpecificLocale() | ||
|
@@ -257,7 +259,7 @@ public function testStrExcerpt() | |
$this->assertNull(Str::excerpt('', '/')); | ||
} | ||
|
||
public function testStrBefore() | ||
public function testStrBefore(): void | ||
{ | ||
$this->assertSame('han', Str::before('hannah', 'nah')); | ||
$this->assertSame('ha', Str::before('hannah', 'n')); | ||
|
@@ -267,6 +269,12 @@ public function testStrBefore() | |
$this->assertSame('han', Str::before('han0nah', '0')); | ||
$this->assertSame('han', Str::before('han0nah', 0)); | ||
$this->assertSame('han', Str::before('han2nah', 2)); | ||
$this->assertSame('', Str::before('', '')); | ||
$this->assertSame('', Str::before('', 'a')); | ||
$this->assertSame('', Str::before('a', 'a')); | ||
$this->assertSame('foo', Str::before('[email protected]', '@')); | ||
$this->assertSame('foo', Str::before('foo@@bar.com', '@')); | ||
$this->assertSame('', Str::before('@[email protected]', '@')); | ||
} | ||
|
||
public function testStrBeforeLast(): void | ||
|
@@ -286,7 +294,7 @@ public function testStrBeforeLast(): void | |
$this->assertSame('yvette', Str::beforeLast("yvette\tyv0et0te", "\t")); | ||
} | ||
|
||
public function testStrBetween() | ||
public function testStrBetween(): void | ||
{ | ||
$this->assertSame('abc', Str::between('abc', '', 'c')); | ||
$this->assertSame('abc', Str::between('abc', 'a', '')); | ||
|
@@ -299,6 +307,9 @@ public function testStrBetween() | |
$this->assertSame('a]ab[b', Str::between('[a]ab[b]', '[', ']')); | ||
$this->assertSame('foo', Str::between('foofoobar', 'foo', 'bar')); | ||
$this->assertSame('bar', Str::between('foobarbar', 'foo', 'bar')); | ||
$this->assertSame('234', Str::between('12345', 1, 5)); | ||
$this->assertSame('45', Str::between('123456789', '123', '6789')); | ||
$this->assertSame('nothing', Str::between('nothing', 'foo', 'bar')); | ||
} | ||
|
||
public function testStrBetweenFirst() | ||
|