-
Notifications
You must be signed in to change notification settings - Fork 16
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 #29 from stof/fix_entity_conversion
Fix the handling of Unicode characters
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
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,34 @@ | ||
<?php | ||
use PHPUnit\Framework\TestCase; | ||
|
||
use function Pinky\transformString; | ||
|
||
class EncodingTest extends TestCase | ||
{ | ||
/** | ||
* @param string $expected | ||
* @param string $input | ||
* | ||
* @dataProvider provideStrings | ||
*/ | ||
public function testMultiByteContent($expected, $input) | ||
{ | ||
$this->assertEquals($expected, trim(transformString($input)->saveHTML())); | ||
} | ||
|
||
public static function provideStrings() | ||
{ | ||
yield [ | ||
'<html><body><p>ASCII only</p></body></html>', | ||
'ASCII only', | ||
]; | ||
yield [ | ||
'<html><body><p>Twoje zamówienie oczekuje na wpłatę zadatku 🇳🇱</p></body></html>', | ||
'Twoje zamówienie oczekuje na wpłatę zadatku 🇳🇱', | ||
]; | ||
yield [ | ||
'<html><body><p>Привет мир!</p></body></html>', | ||
'Привет мир!', | ||
]; | ||
} | ||
} |