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.
[Fix] Str::Mask() for consecutively repeating chars (laravel#42295)
- Add some additional test cases to verify behaviour for more than 2 repeating characters. - Add some cases for testing the masking from the start of the string, before the start of the string and end of string. (cherry picked from commit a917528)
- Loading branch information
1 parent
e630199
commit 08eb155
Showing
2 changed files
with
24 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
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 |
---|---|---|
|
@@ -508,6 +508,19 @@ public function testMask() | |
|
||
$this->assertSame('这是一***', Str::mask('这是一段中文', '*', 3)); | ||
$this->assertSame('**一段中文', Str::mask('这是一段中文', '*', 0, 2)); | ||
|
||
$this->assertSame('ma*[email protected]', Str::mask('[email protected]', '*', 2, 1)); | ||
$this->assertSame('ma***email.com', Str::mask('[email protected]', '*', 2, 3)); | ||
$this->assertSame('ma************', Str::mask('[email protected]', '*', 2)); | ||
|
||
$this->assertSame('mari*@email.com', Str::mask('[email protected]', '*', 4, 1)); | ||
$this->assertSame('tamar*@email.com', Str::mask('[email protected]', '*', 5, 1)); | ||
|
||
$this->assertSame('*[email protected]', Str::mask('[email protected]', '*', 0, 1)); | ||
$this->assertSame('[email protected]*', Str::mask('[email protected]', '*', -1, 1)); | ||
$this->assertSame('[email protected]*', Str::mask('[email protected]', '*', -1)); | ||
$this->assertSame('***************', Str::mask('[email protected]', '*', -15)); | ||
$this->assertSame('***************', Str::mask('[email protected]', '*', 0)); | ||
} | ||
|
||
public function testMatch() | ||
|