-
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.
Merge pull request #7 from atrapalo/UpdateComposer
Remove static and tested it
- Loading branch information
Showing
2 changed files
with
96 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace Atrapalo\PHPTools\Tests\String; | ||
|
||
use Atrapalo\PHPTools\String\StringHandler; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Class StringHandlerTest | ||
* @package Atrapalo\PHPTools\Tests\String | ||
*/ | ||
class StringHandlerTest extends TestCase | ||
{ | ||
/** @var StringHandler */ | ||
private $stringHandler; | ||
|
||
protected function setUp() | ||
{ | ||
$this->stringHandler = StringHandler::getInstance(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function removeAccentsWithoutAccents() | ||
{ | ||
$text = '*Text without accents and (special chars).'; | ||
|
||
$this->assertSame($text, $this->stringHandler->removeAccents($text)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function removeAccentsWithAccents() | ||
{ | ||
$text = '*Téxt without Àcceñts and ($pecial Çhars).'; | ||
$expectedText = '*Text without Accents and ($pecial Chars).'; | ||
|
||
$this->assertSame($expectedText, $this->stringHandler->removeAccents($text)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function removeAccentsWithAllAccents() | ||
{ | ||
$text = 'ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿºªç'; | ||
$expectedText = 'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyyoac'; | ||
|
||
$this->assertSame($expectedText, $this->stringHandler->removeAccents($text)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function sanitizeString() | ||
{ | ||
$text = '*Téxt without Àcceñts and ($pecial Çhars).'; | ||
$expectedText = 'Text without Accents and pecial Chars'; | ||
|
||
$this->assertSame($expectedText, $this->stringHandler->sanitizeString($text)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function sanitizeUrl() | ||
{ | ||
$urlText = '*Téxt € without__ Àcceñts and---+----($pecial Çhars).'; | ||
$expectedUrlText = 'text-euro-without__-accents-and-dollarpecial-chars'; | ||
|
||
$this->assertSame($expectedUrlText, $this->stringHandler->sanitizeUrl($urlText)); | ||
} | ||
} |