-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Helper\Html
support UTF-8 HTML input
Assume UTF-8 encoding. Not assuming UTF-8 would mangle text such as "русский" Fixes #444
- Loading branch information
Showing
3 changed files
with
43 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
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,33 @@ | ||
<?php | ||
|
||
namespace PhpOffice\PhpSpreadsheetTests\Helper; | ||
|
||
use PhpOffice\PhpSpreadsheet\Helper\Html; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class HtmlTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider providerUtf8EncodingSupport | ||
* | ||
* @param mixed $expected | ||
* @param mixed $input | ||
*/ | ||
public function testUtf8EncodingSupport($expected, $input) | ||
{ | ||
$html = new Html(); | ||
$actual = $html->toRichTextObject($input); | ||
|
||
self::assertSame($expected, $actual->getPlainText()); | ||
} | ||
|
||
public function providerUtf8EncodingSupport() | ||
{ | ||
return [ | ||
['foo', 'foo'], | ||
['können', 'können'], | ||
['русский', 'русский'], | ||
["foo\nbar", '<p>foo</p><p>bar</p>'], | ||
]; | ||
} | ||
} |