-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add some tests and improvement test coverage for Str::camel
- Loading branch information
1 parent
a8829f7
commit 8c8c4eb
Showing
1 changed file
with
12 additions
and
2 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 |
---|---|---|
|
@@ -936,7 +936,7 @@ public function testMask() | |
$this->assertSame('***************', Str::mask('[email protected]', '*', 0)); | ||
} | ||
|
||
public function testMatch() | ||
public function testMatch(): void | ||
{ | ||
$this->assertSame('bar', Str::match('/bar/', 'foo bar')); | ||
$this->assertSame('bar', Str::match('/foo (.*)/', 'foo bar')); | ||
|
@@ -946,9 +946,12 @@ public function testMatch() | |
|
||
$this->assertEquals(['un', 'ly'], Str::matchAll('/f(\w*)/', 'bar fun bar fly')->all()); | ||
$this->assertEmpty(Str::matchAll('/nothing/', 'bar fun bar fly')); | ||
|
||
$this->assertEmpty(Str::match('/pattern/', '')); | ||
$this->assertEmpty(Str::matchAll('/pattern/', '')); | ||
} | ||
|
||
public function testCamel() | ||
public function testCamel(): void | ||
{ | ||
$this->assertSame('laravelPHPFramework', Str::camel('Laravel_p_h_p_framework')); | ||
$this->assertSame('laravelPhpFramework', Str::camel('Laravel_php_framework')); | ||
|
@@ -960,6 +963,13 @@ public function testCamel() | |
$this->assertSame('fooBar', Str::camel('foo_bar')); // test cache | ||
$this->assertSame('fooBarBaz', Str::camel('Foo-barBaz')); | ||
$this->assertSame('fooBarBaz', Str::camel('foo-bar_baz')); | ||
|
||
$this->assertSame('', Str::camel('')); | ||
$this->assertSame('lARAVELPHPFRAMEWORK', Str::camel('LARAVEL_PHP_FRAMEWORK')); | ||
$this->assertSame('laravelPhpFramework', Str::camel(' laravel php framework ')); | ||
|
||
$this->assertSame('foo1Bar', Str::camel('foo1_bar')); | ||
$this->assertSame('1FooBar', Str::camel('1 foo bar')); | ||
} | ||
|
||
public function testCharAt() | ||
|