mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-25 17:28:20 +00:00
070bc68514
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.
35 lines
820 B
PHP
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'],
|
|
];
|
|
}
|
|
}
|