Skip to content

Commit

Permalink
added str_replace_all_except_numbers test
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Aug 24, 2023
1 parent 7a1a209 commit d3dabac
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/StringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use PHPUnit\Framework\TestCase;
use function PhPease\String\str_contains;
use function PhPease\String\str_ends_with;
use function PhPease\String\str_replace_all_except_numbers;
use function PhPease\String\str_starts_with;
use function PhPease\String\to_camel_case;
use function PhPease\Variable\is_stricly_true;
Expand Down Expand Up @@ -50,4 +51,12 @@ public function testStrToCamelCase()
$this->assertEquals('ThatClassName', to_camel_case('That-Class_Name'));
$this->assertEquals('aMethodName', lcfirst( to_camel_case('a method name') ));
}

public function testStrReplaceAllExceptNumbers()
{
$this->assertEquals('20_08_2012_20_13_33', str_replace_all_except_numbers('20.08.2012 20:13:33'));
$this->assertEquals('20_08_2012_20_13_33', str_replace_all_except_numbers('20.08.2012 - 20:13:33'));
$this->assertEquals('20-08-2012-20-13-33', str_replace_all_except_numbers('20.08.2012 - 20:13:33', '-'));
$this->assertEquals('20-08-2012---20-13-33', str_replace_all_except_numbers('20.08.2012 - 20:13:33', '-', false));
}
}

0 comments on commit d3dabac

Please sign in to comment.