HtmlTest.php 820 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Helper;
  3. use PhpOffice\PhpSpreadsheet\Helper\Html;
  4. use PHPUnit\Framework\TestCase;
  5. class HtmlTest extends TestCase
  6. {
  7. /**
  8. * @dataProvider providerUtf8EncodingSupport
  9. *
  10. * @param mixed $expected
  11. * @param mixed $input
  12. */
  13. public function testUtf8EncodingSupport($expected, $input): void
  14. {
  15. $html = new Html();
  16. $actual = $html->toRichTextObject($input);
  17. self::assertSame($expected, $actual->getPlainText());
  18. }
  19. public function providerUtf8EncodingSupport(): array
  20. {
  21. return [
  22. ['foo', 'foo'],
  23. ['können', 'können'],
  24. ['русский', 'русский'],
  25. ["foo\nbar", '<p>foo</p><p>bar</p>'],
  26. 'issue2810' => ['0', '0'],
  27. ];
  28. }
  29. }