Files
PhpSpreadsheet/tests/PhpSpreadsheetTests/Helper/HtmlTest.php
T
oleibman 070bc68514 Html Reader Converting Cell Containing 0 to Null String (#2813)
Fix #2810. Repairing some Phpstan diagnostics, used `?:` rather than `??` in a few places.

2 different Html modules are affected. Also, Ods Reader, but its problem is with sheet title rather than cell contents. And, as it turns out, Ods Reader was already not handling sheets with a title of `0` correctly - it made a truthy test before setting sheet title. That is now changed to truthy or numeric. Other readers are not susceptible to this problem. Tests are added.
2022-05-10 07:33:45 -07:00

35 lines
820 B
PHP

<?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): void
{
$html = new Html();
$actual = $html->toRichTextObject($input);
self::assertSame($expected, $actual->getPlainText());
}
public function providerUtf8EncodingSupport(): array
{
return [
['foo', 'foo'],
['können', 'können'],
['русский', 'русский'],
["foo\nbar", '<p>foo</p><p>bar</p>'],
'issue2810' => ['0', '0'],
];
}
}